ggc-common.c (ggc_prune_overhead_list): Do not delete surviving allocations.
authorJan Hubicka <jh@suse.cz>
Wed, 6 Nov 2019 19:36:22 +0000 (20:36 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Wed, 6 Nov 2019 19:36:22 +0000 (19:36 +0000)
* ggc-common.c (ggc_prune_overhead_list): Do not delete surviving
allocations.
* mem-stats.h (mem_alloc_description<T>::release_object_overhead):
Do not silently ignore summary corruptions.

From-SVN: r277890

gcc/ChangeLog
gcc/ggc-common.c
gcc/mem-stats.h

index daf1194fe8b0e7d62effc24c5ff34ad311e293d7..f451b1f91b77eada0522eb903bdb9f20d7d3da05 100644 (file)
@@ -1,3 +1,10 @@
+2019-11-06  Jan Hubicka  <jh@suse.cz>
+
+       * ggc-common.c (ggc_prune_overhead_list): Do not delete surviving
+       allocations.
+       * mem-stats.h (mem_alloc_description<T>::release_object_overhead):
+       Do not silently ignore summary corruptions.
+
 2019-11-06  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-vect-loop.c (vect_analyze_loop): Only try to vectorize
index a7edb1591f854b8125fc0061ebca4de8642d7f2e..f94c39f110d3d5658828bd336b60db1ada3b06d7 100644 (file)
@@ -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.  */
index c2329c2b14d96bc6d22c30d47c69e349119c5de0..c80be76927acb8791f53c113e48dc2fcb8b2784f 100644 (file)
@@ -535,11 +535,8 @@ inline void
 mem_alloc_description<T>::release_object_overhead (void *ptr)
 {
   std::pair <T *, size_t> *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