cvs: ZendEngine2 / zend_alloc.c zend_alloc.h zend_mm.h

From: Date: Mon, 24 Jun 2002 07:22:27 +0000
Subject: cvs: ZendEngine2 / zend_alloc.c zend_alloc.h zend_mm.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-193@lists.php.net to get a copy of this message
andi Mon Jun 24 03:22:27 2002 EDT Modified files: /ZendEngine2 zend_alloc.c zend_alloc.h zend_mm.h Log: - Don't keep allocated blocks in a linked list if we're in non-debug mode - as now the memory manager takes care to nuke all leaking blocks. Index: ZendEngine2/zend_alloc.c diff -u ZendEngine2/zend_alloc.c:1.103 ZendEngine2/zend_alloc.c:1.104 --- ZendEngine2/zend_alloc.c:1.103 Sat Jun 22 12:09:15 2002 +++ ZendEngine2/zend_alloc.c Mon Jun 24 03:22:24 2002 @@ -172,7 +172,9 @@ return (void *)p; } p->cached = 0; +#if ZEND_DEBUG || !defined(ZEND_MM) ADD_POINTER_TO_LIST(p); +#endif p->size = size; /* Save real size for correct cache output */ #if ZEND_DEBUG p->filename = __zend_filename; @@ -231,7 +233,9 @@ return; } HANDLE_BLOCK_INTERRUPTIONS(); +#if ZEND_DEBUG || !defined(ZEND_MM) REMOVE_POINTER_FROM_LIST(p); +#endif #if MEMORY_LIMIT AG(allocated_memory) -= SIZE; @@ -288,7 +292,9 @@ CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size); HANDLE_BLOCK_INTERRUPTIONS(); +#if ZEND_DEBUG || !defined(ZEND_MM) REMOVE_POINTER_FROM_LIST(p); +#endif p = (zend_mem_header *) ZEND_DO_REALLOC(p, sizeof(zend_mem_header)+MEM_HEADER_PADDING+SIZE+END_MAGIC_SIZE); if (!p) { if (!allow_failure) { @@ -299,11 +305,15 @@ exit(1); #endif } +#if ZEND_DEBUG || !defined(ZEND_MM) ADD_POINTER_TO_LIST(orig); +#endif HANDLE_UNBLOCK_INTERRUPTIONS(); return (void *)NULL; } +#if ZEND_DEBUG || !defined(ZEND_MM) ADD_POINTER_TO_LIST(p); +#endif #if ZEND_DEBUG p->filename = __zend_filename; p->lineno = __zend_lineno; @@ -461,7 +471,7 @@ return; } #endif - +#if ZEND_DEBUG || !defined(ZEND_MM) for (fci=0; fci<MAX_FAST_CACHE_TYPES; fci++) { fast_cache_list_entry = AG(fast_cache_list_head)[fci]; while (fast_cache_list_entry) { @@ -579,6 +589,7 @@ } #endif +#endif #endif } Index: ZendEngine2/zend_alloc.h diff -u ZendEngine2/zend_alloc.h:1.38 ZendEngine2/zend_alloc.h:1.39 --- ZendEngine2/zend_alloc.h:1.38 Sat Jun 22 10:37:49 2002 +++ ZendEngine2/zend_alloc.h Mon Jun 24 03:22:25 2002 @@ -26,6 +26,8 @@ #include "../TSRM/TSRM.h" #include "zend_globals_macros.h" +#include "zend_mm.h" + #define MEM_BLOCK_START_MAGIC 0x7312F8DCL #define MEM_BLOCK_END_MAGIC 0x2A8FCC84L #define MEM_BLOCK_FREED_MAGIC 0x99954317L @@ -43,8 +45,10 @@ THREAD_T thread_id; # endif #endif +#if ZEND_DEBUG || !defined(ZEND_MM) struct _zend_mem_header *pNext; struct _zend_mem_header *pLast; +#endif unsigned int size:31; unsigned int cached:1; } zend_mem_header; Index: ZendEngine2/zend_mm.h diff -u ZendEngine2/zend_mm.h:1.5 ZendEngine2/zend_mm.h:1.6 --- ZendEngine2/zend_mm.h:1.5 Wed Jun 19 12:29:07 2002 +++ ZendEngine2/zend_mm.h Mon Jun 24 03:22:25 2002 @@ -22,7 +22,7 @@ #include <sys/types.h> -#include "zend.h" +#include "zend_types.h" /* Define this to enable Zend MM */ #undef ZEND_MM

« previous php.zend-engine.cvs (#193) next »