|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-06-15 04:28 UTC] andrei@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 23:00:01 2025 UTC |
Description: ------------ PHP-Gtk leaks memory when using a timeout in a class. It doesn't leak when not using a class. Reproduce code: --------------- <?php //This code leaks class MemTest extends GtkWindow { public function __construct() { parent::__construct(); Gtk::timeout_add(100, array($this, 'shoot')); } public function shoot() { static $t = 0; if (++$t == 1) { Gtk::main_quit(); } return true; } } $mag = new MemTest(); $mag->show(); Gtk::main(); ?> Expected result: ---------------- <?php //This code does not leak Gtk::timeout_add(100, 'timeout'); function timeout() { static $t = 0; if (++$t == 5) { Gtk::main_quit(); return false; } return true; } Gtk::main(); ?> Actual result: -------------- cweiske:/data/cvs/phpgtk2/test> p5 memleak_device_get_state.phpw [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/phpgtk2/php-gtk/main/php_gtk_util.c(930) : Freeing 0x08E085EC (35 bytes), script=memleak_device_get_state.phpw /data/cvs/php/php-5.1.4/Zend/zend_hash.c(383) : Actual location (location was relayed) Last leak repeated 3 times [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/phpgtk2/php-gtk/main/php_gtk_util.c(846) : Freeing 0x08E019A4 (16 bytes), script=memleak_device_get_state.phpw [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/phpgtk2/php-gtk/main/php_gtk_util.c(866) : Freeing 0x08E0190C (16 bytes), script=memleak_device_get_state.phpw [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/phpgtk2/php-gtk/main/php_gtk_util.c(921) : Freeing 0x08E01884 (32 bytes), script=memleak_device_get_state.phpw /data/cvs/php/php-5.1.4/Zend/zend_hash.c(169) : Actual location (location was relayed) Last leak repeated 1 time [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/php/php-5.1.4/Zend/zend_execute_API.c(644) : Freeing 0x08E0131C (16 bytes), script=memleak_device_get_state.phpw [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/phpgtk2/php-gtk/main/php_gtk_util.c(990) : Freeing 0x08E0122C (16 bytes), script=memleak_device_get_state.phpw [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' ext/gtk+/gtk.overrides(273) : Freeing 0x08E00CB4 (32 bytes), script=memleak_device_get_state.phpw /data/cvs/php/php-5.1.4/Zend/zend_hash.c(169) : Actual location (location was relayed) Last leak repeated 1 time [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' ext/gtk+/gtk.overrides(272) : Freeing 0x08E009D4 (16 bytes), script=memleak_device_get_state.phpw [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/php/php-5.1.4/Zend/zend_vm_execute.h(4190) : Freeing 0x08E03F7C (16 bytes), script=memleak_device_get_state.phpw [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/php/php-5.1.4/Zend/zend_vm_execute.h(3438) : Freeing 0x08E011D4 (35 bytes), script=memleak_device_get_state.phpw /data/cvs/php/php-5.1.4/Zend/zend_hash.c(383) : Actual location (location was relayed) [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/php/php-5.1.4/Zend/zend_vm_execute.h(3407) : Freeing 0x08E0030C (16 bytes), script=memleak_device_get_state.phpw [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/php/php-5.1.4/Zend/zend_vm_execute.h(12588) : Freeing 0x08E002B4 (35 bytes), script=memleak_device_get_state.phpw /data/cvs/php/php-5.1.4/Zend/zend_hash.c(383) : Actual location (location was relayed) [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/php/php-5.1.4/Zend/zend_vm_execute.h(12538) : Freeing 0x08E08144 (32 bytes), script=memleak_device_get_state.phpw /data/cvs/php/php-5.1.4/Zend/zend_hash.c(169) : Actual location (location was relayed) Last leak repeated 1 time [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/php/php-5.1.4/Zend/zend_variables.h(45) : Freeing 0x08DE61A4 (6 bytes), script=memleak_device_get_state.phpw /data/cvs/php/php-5.1.4/Zend/zend_variables.c(120) : Actual location (location was relayed) [Mon Jun 12 15:07:13 2006] Script: 'memleak_device_get_state.phpw' /data/cvs/phpgtk2/php-gtk/main/php_gtk_util.c(873) : Freeing 0x08DE088C (53 bytes), script=memleak_device_get_state.phpw === Total 21 memory leaks detected ===