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

NEWS
Zend/zend_alloc.c

diff --git a/NEWS b/NEWS
index 01d711ab2673d540d3a7bdc9f1489e785258055c..dbbf42e7e94cc68a8f1044fa5e8a66f01b16dcdd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ PHP                                                                        NEWS
 - Fixed "make test" to work for phpized extensions. (Hartmut, Jani)
 - Fixed failing queries (FALSE returned) with mysqli_query() on 64 bit systems.
   (Andrey)
+- Fixed bug #34156 (memory usage remains elevated after memory limit is 
+  reached). (Ilia)
 - Fixed bug #34148 (+,- and . not supported as parts of scheme). (Ilia)
 - Fixed bug #34103 (line numbering not maintained in dom document). (Rob)
 - Fixed bug #34078 (Reflection API problems in methods with boolean or 
index f77c54ef9c271ff8767b158c64e6743757dc7a47..c9d18f31e23d2432063c2e6ef9e697e0fb90e4f7 100644 (file)
@@ -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); \