mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: zend_alloc: Fix compile with ZEND_MM_STAT=0
This commit is contained in:
commit
fc89d1968c
2 changed files with 11 additions and 0 deletions
1
NEWS
1
NEWS
|
@ -14,6 +14,7 @@ PHP NEWS
|
||||||
(Oleg Efimov)
|
(Oleg Efimov)
|
||||||
. Fix handling of references in zval_try_get_long(). (nielsdos)
|
. Fix handling of references in zval_try_get_long(). (nielsdos)
|
||||||
. Do not delete main chunk in zend_gc. (danog, Arnaud)
|
. Do not delete main chunk in zend_gc. (danog, Arnaud)
|
||||||
|
. Fix compile issues with zend_alloc and some non-default options. (nielsdos)
|
||||||
|
|
||||||
- Curl:
|
- Curl:
|
||||||
. Fix memory leak when setting a list via curl_setopt fails. (nielsdos)
|
. Fix memory leak when setting a list via curl_setopt fails. (nielsdos)
|
||||||
|
|
|
@ -2409,7 +2409,9 @@ ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, bool full, bool silent)
|
||||||
/* Make sure the heap free below does not use tracked_free(). */
|
/* Make sure the heap free below does not use tracked_free(). */
|
||||||
heap->custom_heap._free = __zend_free;
|
heap->custom_heap._free = __zend_free;
|
||||||
}
|
}
|
||||||
|
#if ZEND_MM_STAT
|
||||||
heap->size = 0;
|
heap->size = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*shutdown)(bool, bool) = heap->custom_heap._shutdown;
|
void (*shutdown)(bool, bool) = heap->custom_heap._shutdown;
|
||||||
|
@ -2947,6 +2949,7 @@ static zend_always_inline zval *tracked_get_size_zv(zend_mm_heap *heap, void *pt
|
||||||
}
|
}
|
||||||
|
|
||||||
static zend_always_inline void tracked_check_limit(zend_mm_heap *heap, size_t add_size) {
|
static zend_always_inline void tracked_check_limit(zend_mm_heap *heap, size_t add_size) {
|
||||||
|
#if ZEND_MM_STAT
|
||||||
if (add_size > heap->limit - heap->size && !heap->overflow) {
|
if (add_size > heap->limit - heap->size && !heap->overflow) {
|
||||||
#if ZEND_DEBUG
|
#if ZEND_DEBUG
|
||||||
zend_mm_safe_error(heap,
|
zend_mm_safe_error(heap,
|
||||||
|
@ -2958,6 +2961,7 @@ static zend_always_inline void tracked_check_limit(zend_mm_heap *heap, size_t ad
|
||||||
heap->limit, add_size);
|
heap->limit, add_size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *tracked_malloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
static void *tracked_malloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
|
||||||
|
@ -2971,7 +2975,9 @@ static void *tracked_malloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC
|
||||||
}
|
}
|
||||||
|
|
||||||
tracked_add(heap, ptr, size);
|
tracked_add(heap, ptr, size);
|
||||||
|
#if ZEND_MM_STAT
|
||||||
heap->size += size;
|
heap->size += size;
|
||||||
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2982,7 +2988,9 @@ static void tracked_free(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) {
|
||||||
|
|
||||||
zend_mm_heap *heap = AG(mm_heap);
|
zend_mm_heap *heap = AG(mm_heap);
|
||||||
zval *size_zv = tracked_get_size_zv(heap, ptr);
|
zval *size_zv = tracked_get_size_zv(heap, ptr);
|
||||||
|
#if ZEND_MM_STAT
|
||||||
heap->size -= Z_LVAL_P(size_zv);
|
heap->size -= Z_LVAL_P(size_zv);
|
||||||
|
#endif
|
||||||
zend_hash_del_bucket(heap->tracked_allocs, (Bucket *) size_zv);
|
zend_hash_del_bucket(heap->tracked_allocs, (Bucket *) size_zv);
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
@ -3007,7 +3015,9 @@ static void *tracked_realloc(void *ptr, size_t new_size ZEND_FILE_LINE_DC ZEND_F
|
||||||
|
|
||||||
ptr = __zend_realloc(ptr, new_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
ptr = __zend_realloc(ptr, new_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
|
||||||
tracked_add(heap, ptr, new_size);
|
tracked_add(heap, ptr, new_size);
|
||||||
|
#if ZEND_MM_STAT
|
||||||
heap->size += new_size - old_size;
|
heap->size += new_size - old_size;
|
||||||
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue