Re: Changing font colors on the fly == memory leak!
| From: | Andrei Zmievski | Date: | Wed, 04 Jan 2006 01:33:12 +0000 |
| Subject: | Re: Changing font colors on the fly == memory leak! | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-6502@lists.php.net to get a copy of this message | ||
Are you using PHP-GTK 2/PHP 5.1? If so, you shouldn't use &new -- do simple 'new' instead.
-Andrei
On Jan 3, 2006, at 5:05 PM, Brian A. Stumm wrote:
$green=&new gdkcolor('darkgreen'); $yellow=&new gdkcolor('darkgoldenrod'); At that point my app would take down a linux box with 256MB memory in less than a day. The version represented in post # 1's code ate 40% of system memory in 80 some hours. In the 2 scripts posted the key is where this line of code is located. $st1 = $st1->copy(); In version A the above line was in the function. In version B its outside the function and re-used. I believe it is true that php does not free memory until the script completes so reusing things/widgets whenever possible can really help reduce usage. At this point my app uses about 18Megs memory and can run for at least 3 days with no perceived memory usage increase. --PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php