diff options
author | Zeev Suraski <zeev@php.net> | 1999-11-27 00:04:36 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 1999-11-27 00:04:36 +0000 |
commit | 4481898ff7d4eb47f6127689c7cfe7d19b662571 (patch) | |
tree | 26f87cdf3e1b7d4efa9a02ed278cac5cf7980152 /Zend/zend_alloc.c | |
parent | 6cdebd85a28806ab01e768830ee4ca2b8b0c1bba (diff) | |
download | php-git-4481898ff7d4eb47f6127689c7cfe7d19b662571.tar.gz |
Add ability to disable the memory cache
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r-- | Zend/zend_alloc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 9fe4c8a061..ed1a7b9f48 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -35,6 +35,9 @@ static zend_alloc_globals alloc_globals; #endif +#define ZEND_DISABLE_MEMORY_CACHE 0 + + #if ZEND_DEBUG # define END_MAGIC_SIZE sizeof(long) # define END_ALIGNMENT(size) (((size)%PLATFORM_ALIGNMENT)?(PLATFORM_ALIGNMENT-((size)%PLATFORM_ALIGNMENT)):0) @@ -104,7 +107,7 @@ ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) HANDLE_BLOCK_INTERRUPTIONS(); - if ((size < MAX_CACHED_MEMORY) && (AG(cache_count)[size] > 0)) { + if (!ZEND_DISABLE_MEMORY_CACHE && (size < MAX_CACHED_MEMORY) && (AG(cache_count)[size] > 0)) { p = AG(cache)[size][--AG(cache_count)[size]]; #if ZEND_DEBUG p->filename = __zend_filename; @@ -164,7 +167,8 @@ ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) memset(ptr, 0x5a, p->size); #endif - if (!p->persistent && (p->size < MAX_CACHED_MEMORY) && (AG(cache_count)[p->size] < MAX_CACHED_ENTRIES)) { + if (!ZEND_DISABLE_MEMORY_CACHE + && !p->persistent && (p->size < MAX_CACHED_MEMORY) && (AG(cache_count)[p->size] < MAX_CACHED_ENTRIES)) { AG(cache)[p->size][AG(cache_count)[p->size]++] = p; p->cached = 1; #if ZEND_DEBUG |