diff options
Diffstat (limited to 'ZendAccelerator.c')
| -rw-r--r-- | ZendAccelerator.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/ZendAccelerator.c b/ZendAccelerator.c index bb571a4805..87b60f1e01 100644 --- a/ZendAccelerator.c +++ b/ZendAccelerator.c @@ -71,8 +71,6 @@ typedef int gid_t; #include <sys/stat.h> #include <errno.h> -#define MIN_FREE_MEMORY 64*1024 - #define SHM_PROTECT() \ do { \ if (ZCG(accel_directives).protect_memory) { \ @@ -853,6 +851,7 @@ static inline int do_validate_timestamps(zend_persistent_script *persistent_scri static void zend_accel_schedule_restart_if_necessary(TSRMLS_D) { if ((((double) ZSMMG(wasted_shared_memory)) / ZCG(accel_directives).memory_consumption) >= ZCG(accel_directives).max_wasted_percentage) { + ZSMMG(memory_exhausted) = 1; zend_accel_schedule_restart(TSRMLS_C); } } @@ -1031,14 +1030,12 @@ static void zend_accel_add_key(char *key, unsigned int key_length, zend_accel_ha if (zend_accel_hash_is_full(&ZCSG(hash))) { zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!"); ZSMMG(memory_exhausted) = 1; + zend_accel_schedule_restart(TSRMLS_C); } else { char *new_key = zend_shared_alloc(key_length + 1); if (new_key) { memcpy(new_key, key, key_length + 1); zend_accel_hash_update(&ZCSG(hash), new_key, key_length + 1, 1, bucket); - } else { - zend_accel_error(ACCEL_LOG_DEBUG, "No more memory!"); - ZSMMG(memory_exhausted) = 1; } } } @@ -1060,7 +1057,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr if (zend_accel_hash_is_full(&ZCSG(hash))) { zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!"); ZSMMG(memory_exhausted) = 1; - zend_accel_schedule_restart_if_necessary(TSRMLS_C); + zend_accel_schedule_restart(TSRMLS_C); zend_shared_alloc_unlock(TSRMLS_C); return new_persistent_script; } @@ -1088,11 +1085,6 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr /* Allocate shared memory */ ZCG(mem) = zend_shared_alloc(memory_used); if (!ZCG(mem)) { - zend_accel_error(ACCEL_LOG_DEBUG, "No more memory!"); - zend_accel_schedule_restart_if_necessary(TSRMLS_C); - if (zend_shared_alloc_get_largest_free_block() < MIN_FREE_MEMORY) { - ZSMMG(memory_exhausted) = 1; - } zend_shared_alloc_unlock(TSRMLS_C); return new_persistent_script; } @@ -1126,6 +1118,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr if (!zend_accel_hash_update(&ZCSG(hash), key, key_length + 1, 1, bucket)) { zend_accel_error(ACCEL_LOG_DEBUG, "No more entries in hash table!"); ZSMMG(memory_exhausted) = 1; + zend_accel_schedule_restart(TSRMLS_C); } } @@ -1469,6 +1462,7 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int persistent_script->corrupted = 1; persistent_script->timestamp = 0; ZSMMG(wasted_shared_memory) += persistent_script->dynamic_members.memory_consumption; + zend_accel_schedule_restart_if_necessary(TSRMLS_C); } zend_shared_alloc_unlock(TSRMLS_C); persistent_script = NULL; @@ -1489,6 +1483,7 @@ static zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int persistent_script->corrupted = 1; persistent_script->timestamp = 0; ZSMMG(wasted_shared_memory) += persistent_script->dynamic_members.memory_consumption; + zend_accel_schedule_restart_if_necessary(TSRMLS_C); } zend_shared_alloc_unlock(TSRMLS_C); persistent_script = NULL; |
