diff options
author | Nikita Popov <nikic@php.net> | 2015-04-17 12:37:51 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-04-18 17:31:11 +0200 |
commit | aef96d5169111db7e17f06ff6b13d56cd980cb8c (patch) | |
tree | 5b6da35be905bfe9b887d1336b31e155900cac68 /Zend/zend_objects_API.c | |
parent | f616a6f1ebf7ec8ece54022791f078bea8a1e973 (diff) | |
download | php-git-aef96d5169111db7e17f06ff6b13d56cd980cb8c.tar.gz |
Partially enable leak reports for objects
Cycle leaks are currently not reported, because this needs further
work.
The last GC run has been moved to run earlier (before the object
store free), so that array cycles that hold references to objects
don't show up as leaks. Fingers crossed that this doesn't adversely
affect anything else.
Diffstat (limited to 'Zend/zend_objects_API.c')
-rw-r--r-- | Zend/zend_objects_API.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c index 92e36a5558..4be4723105 100644 --- a/Zend/zend_objects_API.c +++ b/Zend/zend_objects_API.c @@ -78,7 +78,7 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects { uint32_t i; - /* Free object properties but don't free object their selves */ + /* Free object contents, but don't free objects themselves */ for (i = objects->top - 1; i > 0 ; i--) { zend_object *obj = objects->object_buckets[i]; @@ -94,11 +94,13 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects } } - /* Now free objects theirselves */ + /* Free objects themselves if they now have a refcount of 0, which means that + * they were previously part of a cycle. Everything else will report as a leak. + * Cycles are allowed because not all internal objects currently support GC. */ for (i = 1; i < objects->top ; i++) { zend_object *obj = objects->object_buckets[i]; - if (IS_OBJ_VALID(obj)) { + if (IS_OBJ_VALID(obj) && GC_REFCOUNT(obj) == 0) { /* Not adding to free list as we are shutting down anyway */ void *ptr = ((char*)obj) - obj->handlers->offset; GC_REMOVE_FROM_BUFFER(obj); |