mirror of
https://github.com/php/php-src.git
synced 2024-11-30 21:35:36 +08:00
Fixed reporting about repeatable "huge" memory leaks.
This commit is contained in:
parent
a9bbe5c384
commit
c61604b9a9
@ -2014,6 +2014,27 @@ static zend_long zend_mm_find_leaks(zend_mm_heap *heap, zend_mm_chunk *p, int i,
|
||||
return count;
|
||||
}
|
||||
|
||||
static zend_long zend_mm_find_leaks_huge(zend_mm_heap *heap, zend_mm_huge_list *list)
|
||||
{
|
||||
zend_long count = 0;
|
||||
zend_mm_huge_list *prev = list;
|
||||
zend_mm_huge_list *p = list->next;
|
||||
|
||||
while (p) {
|
||||
if (p->dbg.filename == list->dbg.filename && p->dbg.lineno == list->dbg.lineno) {
|
||||
prev->next = p->next;
|
||||
zend_mm_chunk_free(heap, p->ptr, p->size);
|
||||
zend_mm_free_heap(heap, p, NULL, 0, NULL, 0);
|
||||
count++;
|
||||
} else {
|
||||
prev = p;
|
||||
}
|
||||
p = prev->next;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static void zend_mm_check_leaks(zend_mm_heap *heap)
|
||||
{
|
||||
zend_mm_huge_list *list;
|
||||
@ -2028,8 +2049,6 @@ static void zend_mm_check_leaks(zend_mm_heap *heap)
|
||||
while (list) {
|
||||
zend_mm_huge_list *q = list;
|
||||
|
||||
heap->huge_list = list->next;
|
||||
|
||||
leak.addr = list->ptr;
|
||||
leak.size = list->dbg.size;
|
||||
leak.filename = list->dbg.filename;
|
||||
@ -2039,13 +2058,13 @@ static void zend_mm_check_leaks(zend_mm_heap *heap)
|
||||
|
||||
zend_message_dispatcher(ZMSG_LOG_SCRIPT_NAME, NULL);
|
||||
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, &leak);
|
||||
//??? repeated = zend_mm_find_leaks_huge(segment, p);
|
||||
repeated = zend_mm_find_leaks_huge(heap, list);
|
||||
total += 1 + repeated;
|
||||
if (repeated) {
|
||||
zend_message_dispatcher(ZMSG_MEMORY_LEAK_REPEATED, (void *)(zend_uintptr_t)repeated);
|
||||
}
|
||||
|
||||
list = list->next;
|
||||
heap->huge_list = list = list->next;
|
||||
zend_mm_chunk_free(heap, q->ptr, q->size);
|
||||
zend_mm_free_heap(heap, q, NULL, 0, NULL, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user