summaryrefslogtreecommitdiff
path: root/Zend/zend_alloc.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2005-08-18 15:14:12 +0000
committerIlia Alshanetsky <iliaa@php.net>2005-08-18 15:14:12 +0000
commit3b329a992606889c9ca43b1fe5e68b11b1166247 (patch)
tree7582ea4629c067b71950f2f9dec8d03e2337c47c /Zend/zend_alloc.c
parent4e798f6e024846afcbd620b8efe7b2778c621bb9 (diff)
downloadphp-git-3b329a992606889c9ca43b1fe5e68b11b1166247.tar.gz
MFH: Fixed bug #34156 (memory usage remains elevated after memory limit is
reached);
Diffstat (limited to 'Zend/zend_alloc.c')
-rw-r--r--Zend/zend_alloc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index f77c54ef9c..c9d18f31e2 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -75,7 +75,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); \