com php-src: Always report object leaks: Zend/zend_objects_ API.c
| From: | Nikita Popov | Date: | Fri, 03 Jul 2015 17:33:34 +0000 |
| Subject: | com php-src: Always report object leaks: Zend/zend_objects_ API.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87737@lists.php.net to get a copy of this message | ||
Commit: 866bd89b1d909795bd5ae72121089aef5e0fb204
Author: Nikita Popov <nikic@php.net> Fri, 3 Jul 2015 18:32:09 +0200
Parents: 3c33854e7c2ed15995acc8d3f6cf7ec64d53c698
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=866bd89b1d909795bd5ae72121089aef5e0fb204
Log:
Always report object leaks
Previously cycles were excluded from leak reports, however the
situation here has improved a lot in the meantime and we can
report all leaks.
Changed paths:
M Zend/zend_objects_API.c
Diff:
diff --git a/Zend/zend_objects_API.c b/Zend/zend_objects_API.c
index f48d40e..810de10 100644
--- a/Zend/zend_objects_API.c
+++ b/Zend/zend_objects_API.c
@@ -87,7 +87,7 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store *objects
return;
}
- /* Free object contents, but don't free objects themselves */
+ /* Free object contents, but don't free objects themselves, so they show up as leaks */
end = objects->object_buckets + 1;
obj_ptr = objects->object_buckets + objects->top;
@@ -105,21 +105,6 @@ ZEND_API void zend_objects_store_free_object_storage(zend_objects_store
*objects
}
}
} while (obj_ptr != end);
-
- /* 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. */
- end = objects->object_buckets + objects->top;
- while (obj_ptr != end) {
- obj = *obj_ptr;
- 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);
- efree(ptr);
- }
- obj_ptr++;
- }
}