cvs: Zend / zend_alloc.c
| From: | Ilia Alshanetsky | Date: | Wed, 08 Jan 2003 15:12:58 +0000 |
| Subject: | cvs: Zend / zend_alloc.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-775@lists.php.net to get a copy of this message | ||
iliaa Wed Jan 8 10:12:58 2003 EDT
Modified files:
/Zend zend_alloc.c
Log:
Fixed bug #20802.
Index: Zend/zend_alloc.c
diff -u Zend/zend_alloc.c:1.106 Zend/zend_alloc.c:1.107
--- Zend/zend_alloc.c:1.106 Tue Dec 31 10:55:01 2002
+++ Zend/zend_alloc.c Wed Jan 8 10:12:58 2003
@@ -66,18 +66,22 @@
#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
if (AG(memory_limit)<AG(allocated_memory)) {\
- if ((AG(memory_limit)+1048576)<AG(allocated_memory)) { \
- /* failed to handle this gracefully, exit() */ \
- exit(1); \
- } \
- if (!AG(memory_exhausted)) { \
- if (!file) { \
- zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d
bytes)", AG(memory_limit), s); \
+ int php_mem_limit = AG(memory_limit); \
+ if (AG(memory_limit)+1048576 > AG(allocated_memory) - rs) { \
+ AG(memory_limit) = AG(allocated_memory) + 1048576; \
+ if (file) { \
+ zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted (tried to allocate %d
bytes)", php_mem_limit, s); \
} else { \
- zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to
allocate %d bytes)", AG(memory_limit), file, lineno, s); \
+ 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); \
} \
- AG(memory_exhausted)=1; \
- } \
+ } else { \
+ if (file) { \
+ fprintf(stderr, "Allowed memory size of %d bytes exhausted at %s:%d (tried to
allocate %d bytes)\n", php_mem_limit, file, lineno, s); \
+ } else { \
+ fprintf(stderr, "Allowed memory size of %d bytes exhausted (tried to allocate %d
bytes)\n", php_mem_limit, s); \
+ } \
+ exit(1); \
+ } \
} \
}
# endif