summaryrefslogtreecommitdiff
path: root/Zend
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-05-18 14:51:19 +0000
committerZeev Suraski <zeev@php.net>2000-05-18 14:51:19 +0000
commit957327e8bce823ab3f1f3f73e92ad0a70521d477 (patch)
tree6b681db314048639aac55ade0b024dcac6a5205f /Zend
parent33789f8cdf7110c7081751a249f24089e9f278d6 (diff)
downloadphp-git-957327e8bce823ab3f1f3f73e92ad0a70521d477.tar.gz
Do it in thread unsafe mode for now.
Diffstat (limited to 'Zend')
-rw-r--r--Zend/zend_alloc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index 67e015e09f..576c4c6931 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -319,7 +319,7 @@ ZEND_API int zend_set_memory_limit(unsigned int memory_limit)
ZEND_API void start_memory_manager(ALS_D)
{
-#if 0
+#ifndef ZTS
int i, j;
void *cached_entries[MAX_CACHED_MEMORY][MAX_CACHED_ENTRIES];
#endif
@@ -340,8 +340,11 @@ ZEND_API void start_memory_manager(ALS_D)
memset(AG(fast_cache_list_head), 0, sizeof(AG(fast_cache_list_head)));
memset(AG(cache_count),0,MAX_CACHED_MEMORY*sizeof(unsigned char));
-#if 0
+#ifndef ZTS
/* Initialize cache, to prevent fragmentation */
+ /* We can't do this in ZTS mode, because calling emalloc() from within start_memory_manager()
+ * will yield an endless recursion calling to alloc_globals_ctor()
+ */
for (i=1; i<MAX_CACHED_MEMORY; i++) {
for (j=0; j<MAX_CACHED_ENTRIES; j++) {
cached_entries[i][j] = emalloc(i);