removing APC memleak
| From: | Gregory Beaver | Date: | Sun, 27 Apr 2008 06:12:01 +0000 |
| Subject: | removing APC memleak | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-5414@lists.php.net to get a copy of this message | ||
Hi,
I've found the source of a memleak in APC that affects a few tests in
phar. Basically, if a file includes another file, the refcount element
of each zend_op_array leaks.
Looking at the code with my limited understanding, I was wondering if it
is really necessary to duplicate this item for each op_array? It would
be easier to simply set it to 1000 each time compilation is requested.
My search for any and all decrementing of zend_op_array refcounting only
found the instance that occurs immediately after compilation, so in the
worst case, refcount would be 999.
So is there some other technical reason that
apc_copy_op_array_for_execution() uses this code:
dst->refcount = apc_xmemcpy(src->refcount,
sizeof(src->refcount[0]),
apc_php_malloc);
instead of this code?
*(dst->refcount) = 1000;
The above change fixes the 4 failing phar tests that leak the 4 byte
refcounts when APC is enabled.
Thanks,
Greg