FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » about memory usage with application written with php and mysql
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: about memory usage with application written with php and mysql [message #172537 is a reply to message #172532] Mon, 21 February 2011 17:28 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 2/21/2011 11:51 AM, lovecreatesbeauty wrote:
> On Feb 21, 9:11?pm, "álvaro G. Vicario"
> <alvaro.NOSPAMTH...@demogracia.com.invalid> wrote:
>> I'm not sure about your exact question but Linux tends to consider free
>> memory as a wasted resource (why purchase RAM if you are not using it?)
>> so it normally tries to give it some use (cache or whatever). System
>> load is often a better indicator.
>
> Thank you.
>
> From 89.5% (375900k - 39172k) to 98.7% (375900k - 4876k) of the memory
> is lost in my Php code issuing connection to Mysql. Some queries to
> database may return records of ten thousand.
>
> The Php mannual says it has garbage collection and mysql_close is not
> needed. How can the code lead to memory lose like that? Is the code
> wrong and needs to be rewritten?

As álvaro said - Linux will use memory for buffers, cache, etc. So will
MySQL. Your figures do not necessarily indicate a problem.

And php.net seems to say a lot of things which are not good programming
practice. One of the keys to good programming is to ALWAYS clean up
after yourself - don't expect someone else to do it for you. This
means, for instance, you should always free your result set when you're
done with it, and close the connection when you're through with MySQL.

I think it's comments like these which encourage poor programming
practices in PHP and leads to sloppy code (and problems).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: PHP currency converter with XML feed
Next Topic: fopen with URL *never* fails
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 22:49:08 GMT 2024

Total time taken to generate the page: 0.03051 seconds