]> granicus.if.org Git - php/commitdiff
Fixed bug #34156 (memory usage remains elevated after memory limit is reached)
authorIlia Alshanetsky <iliaa@php.net>
Thu, 18 Aug 2005 15:02:10 +0000 (15:02 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 18 Aug 2005 15:02:10 +0000 (15:02 +0000)
Zend/zend_alloc.c

index 26b41adf51c342d8fccbb1d379d2775a5d0e1f6f..287704be1d88fca46025436df9ef62e719e74285 100644 (file)
@@ -76,7 +76,8 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
 #define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
                                                                if (AG(memory_limit)<AG(allocated_memory)) {\
                                                                        int php_mem_limit = AG(memory_limit); \
-                                                                       if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory) - rs) { \
+                                                                       AG(allocated_memory) -= rs; \
+                                                                       if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory)) { \
                                                                                AG(memory_limit) = AG(allocated_memory) + 1048576; \
                                                                                if (file) { \
                                                                                        zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", php_mem_limit, file, lineno, s); \