detecting a memory leak

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Fri Jun 29, 2007 12:36 am

FaithFreaks wrote:I have a social networking site (faithfreaks.com) that is getting a few hundred thousand hits a day and every few hours pages don't work and the following error is generated:

PHP Fatal error: Out of memory (allocated 262144) (tried to allocate 393216 bytes) in C:\e\xampp\htdocs\faithfreaks\browse.php on line 644

If I restart the server the problem goes away for a few hours, then it's back again.

Is there any way I can detect what part of the code is causing the memory leak?
If you using Apache Server try give to PHP more memory. You can do this in httpd.conf file
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image
User avatar
WiZARD
Moderator
Moderator
Posts: 1240
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Mon Jul 02, 2007 4:26 am

FaithFreaks wrote:We actually have a lot more memory than the site shoud need ... the problem isn't that not enough memory is allocated ... it's that the memory is leaking out somewhere - I just don't know where. We could have 1000 members online at once and be fine, but if we maintain that traffic for any length of time we run out of memory.
I do not know your PHP code and do not know what database you are using for your project but try use some php function to release some memory
see function below:
mysql_free_result ( resource result ) for MySQL
ibase_free_result ( resource result_identifier ) for Interbase
db2_free_result ( resource stmt ) for DB2
and e.t.c.
all info you can find in php Help
"Sex,Drugs and Rock&Roll " replaced at "Sucks,Bugs and Plug&Play";
Image
Post Reply