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: Track heap->real_size for USE_TRACKED_ALLOC
This commit is contained in:
commit
0ee73ccbe5
1 changed files with 4 additions and 0 deletions
|
@ -2411,6 +2411,7 @@ ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, bool full, bool silent)
|
||||||
}
|
}
|
||||||
#if ZEND_MM_STAT
|
#if ZEND_MM_STAT
|
||||||
heap->size = 0;
|
heap->size = 0;
|
||||||
|
heap->real_size = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2977,6 +2978,7 @@ 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
|
#if ZEND_MM_STAT
|
||||||
heap->size += size;
|
heap->size += size;
|
||||||
|
heap->real_size = heap->size;
|
||||||
#endif
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
@ -2990,6 +2992,7 @@ static void tracked_free(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) {
|
||||||
zval *size_zv = tracked_get_size_zv(heap, ptr);
|
zval *size_zv = tracked_get_size_zv(heap, ptr);
|
||||||
#if ZEND_MM_STAT
|
#if ZEND_MM_STAT
|
||||||
heap->size -= Z_LVAL_P(size_zv);
|
heap->size -= Z_LVAL_P(size_zv);
|
||||||
|
heap->real_size = heap->size;
|
||||||
#endif
|
#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);
|
||||||
|
@ -3017,6 +3020,7 @@ static void *tracked_realloc(void *ptr, size_t new_size ZEND_FILE_LINE_DC ZEND_F
|
||||||
tracked_add(heap, ptr, new_size);
|
tracked_add(heap, ptr, new_size);
|
||||||
#if ZEND_MM_STAT
|
#if ZEND_MM_STAT
|
||||||
heap->size += new_size - old_size;
|
heap->size += new_size - old_size;
|
||||||
|
heap->real_size = heap->size;
|
||||||
#endif
|
#endif
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue