From 5d24b4f2dad8883db004481ebd633a0bf8d4f8e9 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 6 Nov 2019 20:36:22 +0100 Subject: [PATCH] ggc-common.c (ggc_prune_overhead_list): Do not delete surviving allocations. * ggc-common.c (ggc_prune_overhead_list): Do not delete surviving allocations. * mem-stats.h (mem_alloc_description::release_object_overhead): Do not silently ignore summary corruptions. From-SVN: r277890 --- gcc/ChangeLog | 7 +++++++ gcc/ggc-common.c | 8 ++++---- gcc/mem-stats.h | 7 ++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index daf1194fe8b..f451b1f91b7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-11-06 Jan Hubicka + + * ggc-common.c (ggc_prune_overhead_list): Do not delete surviving + allocations. + * mem-stats.h (mem_alloc_description::release_object_overhead): + Do not silently ignore summary corruptions. + 2019-11-06 Richard Sandiford * tree-vect-loop.c (vect_analyze_loop): Only try to vectorize diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index a7edb1591f8..f94c39f110d 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -1003,10 +1003,10 @@ ggc_prune_overhead_list (void) for (; it != ggc_mem_desc.m_reverse_object_map->end (); ++it) if (!ggc_marked_p ((*it).first)) - (*it).second.first->m_collected += (*it).second.second; - - delete ggc_mem_desc.m_reverse_object_map; - ggc_mem_desc.m_reverse_object_map = new map_t (13, false, false, false); + { + (*it).second.first->m_collected += (*it).second.second; + ggc_mem_desc.m_reverse_object_map->remove ((*it).first); + } } /* Return memory used by heap in kb, 0 if this info is not available. */ diff --git a/gcc/mem-stats.h b/gcc/mem-stats.h index c2329c2b14d..c80be76927a 100644 --- a/gcc/mem-stats.h +++ b/gcc/mem-stats.h @@ -535,11 +535,8 @@ inline void mem_alloc_description::release_object_overhead (void *ptr) { std::pair *entry = m_reverse_object_map->get (ptr); - if (entry) - { - entry->first->release_overhead (entry->second); - m_reverse_object_map->remove (ptr); - } + entry->first->release_overhead (entry->second); + m_reverse_object_map->remove (ptr); } /* Unregister a memory allocation descriptor registered with -- 2.30.2