Prefer already cached version of the script

This commit is contained in:
Dmitry Stogov 2020-05-20 23:04:34 +03:00
parent 3b62e8b9ab
commit 95248491af
2 changed files with 9 additions and 0 deletions

View file

@ -1471,7 +1471,14 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
zend_accel_add_key(key, key_length, bucket);
}
zend_shared_alloc_unlock();
#if 1
/* prefer the script already stored in SHM */
free_persistent_script(new_persistent_script, 1);
*from_shared_memory = 1;
return existing_persistent_script;
#else
return new_persistent_script;
#endif
}
}

View file

@ -64,6 +64,8 @@ void free_persistent_script(zend_persistent_script *persistent_script, int destr
if (!destroy_elements) {
persistent_script->script.function_table.pDestructor = NULL;
persistent_script->script.class_table.pDestructor = NULL;
} else {
destroy_op_array(&persistent_script->script.main_op_array);
}
zend_hash_destroy(&persistent_script->script.function_table);