Re: [PHP-DEV] Leaking references
BB i have hit on this issue while trying to make a sapi module. my BB problem was that memory emalloc-ed _before_ the request got BB efree-ed by the memory manager after the request and when i BB efree it afterwards a total memory mess occurs (sigsegv, BB infinite loop in libc free or something more nasty)... You probably should use plain old malloc when you not inside the request. -- Stanislav Malyshev, Zend Products Engineer [EMAIL PROTECTED] http://www.zend.com/ +972-3-6139665 ext.115 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] Leaking references
hi, I won't be holding my breath for it. That's the basic property of reference-counting, so it's not easy to make it behave differently. Anyway, unless you have very-long-running very-memory-greedy scripts, these leaks shouldn't bother you - Zend memory manager cleans them up on every request. i have hit on this issue while trying to make a sapi module. my problem was that memory emalloc-ed _before_ the request got efree-ed by the memory manager after the request and when i efree it afterwards a total memory mess occurs (sigsegv, infinite loop in libc free or something more nasty)... is there more info on exactly where emalloc tracks memory and when frees all unfreed blocks in the process of sapi_startup php_module_startup // memory alloced here gets freed by request_shutdown (i suppose) php_request_startup php_execute_script php_request_shutdown php_module_shutdown sapi_shutdown or i am missing something important? b. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] Leaking references
DUH!!! I did a buildconf and then the errors disappeared... Thomas Wentzel wrote: Thank you very much, Wez! Perhaps you can be so nice as to answer my next question also ;) Whenever I do a configure with --enable-debug I get close to a zillion errors when compiling (or linking rather) it seems that I get the following two errors for each function in my code: "multiple definition of `foobar'" and "first defined here" Am I supposed to do something particular in order for debug to work??? Regards Thomas Wez Furlong wrote: On 2001-03-28 15:09:27, "Thomas Wentzel" [EMAIL PROTECTED] wrote: I do come up with the most stupid questions - sorry :) Erhm all this talk about memory leaks - made me curious. How do I go about getting the sort of output, that Wez are showing below. Try ./configure --enable-debug and look at your httpd error log. If you have memory problems, most likely the error log is huge ;-) --Wez. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DEV] Leaking references
BTW: This was with CVS PHP updated this morning, ./configure --disable-pear --without-gd --without-mysql --enable-debug zend_hash.c(291) : Freeing 0x0818E474 (37 bytes), script=leak.php Last leak repeated 1 time zend_hash.c(202) : Freeing 0x08193D1C (20 bytes), script=leak.php Last leak repeated 1 time ./zend_execute.c(1848) : Freeing 0x0818E414 (48 bytes), script=leak.php zend_API.c(208) : Actual location (location was relayed) Last leak repeated 1 time ./zend_execute.c(1847) : Freeing 0x08193F3C (12 bytes), script=leak.php Last leak repeated 1 time -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP-DEV] Leaking references
I don't have enough mental strength to dive into that script right now, but :-) be advised that if you create circular references (which apparently you do) then yes, it will leak. PHP doesn't support circular references. Ahhh. It may sound like a stupid question, but why not? And is it likely to in the future? As for the leaks, when on a production system (--disable-debug) does PHP catch and free them after each request (provided they are emalloc'd) ? If so, then I will forget about them. If not, I might have to try another approach. --Wez. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] Leaking references
Erhm all this talk about memory leaks - made me curious. How do I go about getting the sort of output, that Wez are showing below. I suspect that the extension I'm writing on has some severe memory issues. These issues are occuring in the PHP script, that utilizes my extension. Every other reload (or so) it simply crashes in the middle of a larger block of 'pure' PHP code (nowhere near any reference to my extension). Thanks for listening Thomas Wez Furlong wrote: zend_hash.c(291) : Freeing 0x0818E474 (37 bytes), script=leak.php Last leak repeated 1 time zend_hash.c(202) : Freeing 0x08193D1C (20 bytes), script=leak.php Last leak repeated 1 time ./zend_execute.c(1848) : Freeing 0x0818E414 (48 bytes), script=leak.php zend_API.c(208) : Actual location (location was relayed) Last leak repeated 1 time ./zend_execute.c(1847) : Freeing 0x08193F3C (12 bytes), script=leak.php Last leak repeated 1 time -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] Leaking references
I do come up with the most stupid questions - sorry :) Thomas Wentzel wrote: Erhm all this talk about memory leaks - made me curious. How do I go about getting the sort of output, that Wez are showing below. I suspect that the extension I'm writing on has some severe memory issues. These issues are occuring in the PHP script, that utilizes my extension. Every other reload (or so) it simply crashes in the middle of a larger block of 'pure' PHP code (nowhere near any reference to my extension). Thanks for listening Thomas Wez Furlong wrote: zend_hash.c(291) : Freeing 0x0818E474 (37 bytes), script=leak.php Last leak repeated 1 time zend_hash.c(202) : Freeing 0x08193D1C (20 bytes), script=leak.php Last leak repeated 1 time ./zend_execute.c(1848) : Freeing 0x0818E414 (48 bytes), script=leak.php zend_API.c(208) : Actual location (location was relayed) Last leak repeated 1 time ./zend_execute.c(1847) : Freeing 0x08193F3C (12 bytes), script=leak.php Last leak repeated 1 time -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] Leaking references
Hi Wez! On Wed, 28 Mar 2001, Wez Furlong wrote: [I can't reach the PHP web site (100% packet loss), so I can't open a bug report at this time] I have found a leak in the Zend engine: class A { var $t = null; function run($t) { $this-t = $t; return $this-t-run(); } } class C { var $obj = null; function load_and_run() { $this-obj = new A; return $this-obj-run($this); } function run() { return ""; } } function load_it() { $t = new C; echo $t-load_and_run(); } This example looks damn similar with some code I have and produced the same warnings (#9953). So I changed mine to duplicate. -- teodor -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DEV] Leaking references
Thank you very much, Wez! Perhaps you can be so nice as to answer my next question also ;) Whenever I do a configure with --enable-debug I get close to a zillion errors when compiling (or linking rather) it seems that I get the following two errors for each function in my code: "multiple definition of `foobar'" and "first defined here" Am I supposed to do something particular in order for debug to work??? Regards Thomas Wez Furlong wrote: On 2001-03-28 15:09:27, "Thomas Wentzel" [EMAIL PROTECTED] wrote: I do come up with the most stupid questions - sorry :) Erhm all this talk about memory leaks - made me curious. How do I go about getting the sort of output, that Wez are showing below. Try ./configure --enable-debug and look at your httpd error log. If you have memory problems, most likely the error log is huge ;-) --Wez. -- PHP Development Mailing List http://www.php.net/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]