summaryrefslogtreecommitdiff
path: root/Zend/zend_execute_API.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-04-24 18:59:13 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-04-27 10:48:22 +0200
commit48a34bc1202e9664121c9e9aa004c79ac71af3f5 (patch)
tree84d112e40324b30d72a7d604b7914d4fb7a94f47 /Zend/zend_execute_API.c
parent41c7d28c113d1c8e9c98cc834e8479f8567e5e3a (diff)
downloadphp-git-48a34bc1202e9664121c9e9aa004c79ac71af3f5.tar.gz
Add helper APIs for get_gc implementations
get_gc() implementations that need to explore heterogeneous data currently work by computing how many GC entries they need, allocating a buffer for that and storing it on the object. This is inefficient and wastes memory, because the buffer is retained after the GC run. This commit adds an API for a single global GC buffer, which can be reused by get_gc implementations (as only one get_gc call is ever active at the same time). The GC buffer will automatically grow during the GC run and be discarded at the end.
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r--Zend/zend_execute_API.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 1c7c904b19..ce801c3098 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -184,6 +184,8 @@ void init_executor(void) /* {{{ */
EG(persistent_functions_count) = EG(function_table)->nNumUsed;
EG(persistent_classes_count) = EG(class_table)->nNumUsed;
+ EG(get_gc_buffer).start = EG(get_gc_buffer).end = EG(get_gc_buffer).cur = NULL;
+
zend_weakrefs_init();
EG(active) = 1;