{
int handle;
- /* When in shutdown sequesnce - do not reuse previously freed handles, to make sure
+ /* When in shutdown sequence - do not reuse previously freed handles, to make sure
* the dtors for newly created objects are called in zend_objects_store_call_destructors() loop
*/
- if (EG(objects_store).free_list_head != -1 && EXPECTED(!(EG(flags) & EG_FLAGS_IN_SHUTDOWN))) {
+ if (EG(objects_store).free_list_head != -1 && EXPECTED(!(EG(flags) & EG_FLAGS_OBJECT_STORE_NO_REUSE))) {
handle = EG(objects_store).free_list_head;
EG(objects_store).free_list_head = GET_OBJ_BUCKET_NUMBER(EG(objects_store).object_buckets[handle]);
+ } else if (UNEXPECTED(EG(objects_store).top == EG(objects_store).size)) {
+ zend_objects_store_put_cold(object);
+ return;
} else {
- if (EG(objects_store).top == EG(objects_store).size) {
- uint32_t new_size = 2 * EG(objects_store).size;
- EG(objects_store).object_buckets = (zend_object **) erealloc(EG(objects_store).object_buckets, new_size * sizeof(zend_object*));
- /* Assign size after realloc, in case it fails */
- EG(objects_store).size = new_size;
- }
handle = EG(objects_store).top++;
}
object->handle = handle;