diff options
author | Andi Gutmans <andi@php.net> | 2001-06-19 17:59:29 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2001-06-19 17:59:29 +0000 |
commit | 31d4b82bf45384a767b0a876fd01ec7cd3567386 (patch) | |
tree | f31ae4a7d10fe9172a2f5518e4fc0c4baaa4a6e1 | |
parent | a715a08dc8ab131584a97e87ba5fc20ecc7b55b2 (diff) | |
download | php-git-31d4b82bf45384a767b0a876fd01ec7cd3567386.tar.gz |
- MFH
-rw-r--r-- | Zend/zend_alloc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index ade2d03c31..36945d5ed8 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -184,7 +184,11 @@ ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) #endif #if MEMORY_LIMIT CHECK_MEMORY_LIMIT(size, SIZE); + if (AG(allocated_memory) > AG(allocated_memory_peak)) { + AG(allocated_memory_peak) = AG(allocated_memory); + } #endif + HANDLE_UNBLOCK_INTERRUPTIONS(); return (void *)((char *)p + sizeof(zend_mem_header) + MEM_HEADER_PADDING); } @@ -304,7 +308,11 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN #endif #if MEMORY_LIMIT CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size)); + if (AG(allocated_memory) > AG(allocated_memory_peak)) { + AG(allocated_memory_peak) = AG(allocated_memory); + } #endif + p->size = size; HANDLE_UNBLOCK_INTERRUPTIONS(); @@ -389,6 +397,7 @@ ZEND_API void start_memory_manager(ALS_D) AG(memory_limit) = 1<<30; /* rediculous limit, effectively no limit */ AG(allocated_memory) = 0; AG(memory_exhausted) = 0; + AG(allocated_memory_peak) = 0; #endif memset(AG(fast_cache_list_head), 0, sizeof(AG(fast_cache_list_head))); @@ -487,8 +496,10 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache) } #if MEMORY_LIMIT AG(memory_exhausted)=0; + AG(allocated_memory_peak) = 0; #endif + #if (ZEND_DEBUG) do { zval display_memory_cache_stats; |