[RFC] Populate seen_names hash in cooked_index_shard::do_finalize

Message ID 20230210142132.2039087-1-tromey@adacore.com
State New
Headers
Series [RFC] Populate seen_names hash in cooked_index_shard::do_finalize |

Commit Message

Tom Tromey Feb. 10, 2023, 2:21 p.m. UTC
  Hannes pointed out that cooked_index_shard::do_finalize never
populates the seen_names hash table.  This patch adds the necessary
store.  This reduces memory use a little for "gdb gdb":

(before) Space used: 28909568 (+0 for this command)
(after)  Space used: 28884992 (+0 for this command)

... about 24k.  So maybe it's better to just remove this hash?

What this means, btw, is that in gdb there are not many symbols that
are both mentioned in many CUs and that also require name
canonicalization.  It's possible this would differ in other programs.
---
 gdb/dwarf2/cooked-index.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Tom Tromey March 27, 2023, 2:14 p.m. UTC | #1
>>>>> "Tom" == Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> writes:

Tom> Hannes pointed out that cooked_index_shard::do_finalize never
Tom> populates the seen_names hash table.  This patch adds the necessary
Tom> store.  This reduces memory use a little for "gdb gdb":

I'm going to check this in, and also backport it to the gdb 13 branch.

Tom
  

Patch

diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index 3d23a65ad8f..71852237f98 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -356,6 +356,7 @@  cooked_index_shard::do_finalize ()
 		  entry->canonical = canon_name.get ();
 		  m_names.push_back (std::move (canon_name));
 		}
+	      *slot = entry;
 	    }
 	  else
 	    {