Re: Memory profiler for PHP?

From: Date: Tue, 29 May 2007 17:21:47 +0000
Subject: Re: Memory profiler for PHP?
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-7885@lists.php.net to get a copy of this message
PHP itself rarely gives back memory. The freeing you notice must be happening by the GTK portion. When you have a large array you are done with, sometimes setting it to null and unsetting it will trick (probably not the right word) PHP into releasing the memory. However most of the time when you nullify or unset the memory is not given back, but it is marked as empty so PHP will attempt to reuse memory before it goes and grabs more. I use a analog clock that I wrote in PHP that sits and runs for days weeks months, and never ends up using more than 3mb of memory because I made sure that it properly dump objects and image data when done with them. Hope that makes sense, maybe someone else can provide a more technical explanation, I am not all up in the Zend engine thing. - bob Andre Colomb wrote:
Hi! I guess most people use PHP for writing dynamic web content, so the execution times of a script are usually short. But how about us poor PHP-Gtk users who have applications that might run a single script for hours and hours with lots of scope changes and setting / unsetting variables. AFAIK, the Zend engine takes care of almost everything by itself. However, when running my application, I can observe a constantly growing memory footprint in the Windows Task Manager. Sometimes the value drops down significantly (e.g. when clear()ing a GtkTreeModel), but overall it tends to get bigger and bigger. Now, where could this effect come from? Is there any kind of memory profiler for PHP (like electric-fence or dmalloc for C)? Regards, Andre -- Greetings... From: Andre Colomb <acolomb@schickhardt.org>


« previous php.gtk.general (#7885) next »