aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-06-05 09:38:53 -0600
committerTom Tromey <tromey@adacore.com>2024-06-24 09:11:30 -0600
commit4122e647d571b35b4aba73ec481bc2d72d193e54 (patch)
tree7b374b0fc15acefc01f99a3fd754fa1feaf72174 /gdb/symtab.c
parentf59be2ed3946b69a969c65dd7093b4e865bba003 (diff)
downloadgdb-4122e647d571b35b4aba73ec481bc2d72d193e54.zip
gdb-4122e647d571b35b4aba73ec481bc2d72d193e54.tar.gz
gdb-4122e647d571b35b4aba73ec481bc2d72d193e54.tar.bz2
Don't obstack-allocate the call site hash table
The call site hash table is the last hash table using obstack allocation. In one large (non-public) test case, these hash tables take a substiantial amount of memory. Some of this memory is wasted -- whenever the hash table is resized, the old table is not freed. This patch fixes the problem by changing this hash table to be heap-allocated. This means that resizing will no longer "leak" memory.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 39a6915..41d71be 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -428,10 +428,10 @@ compunit_symtab::find_call_site (CORE_ADDR pc) const
/* See symtab.h. */
void
-compunit_symtab::set_call_site_htab (htab_t call_site_htab)
+compunit_symtab::set_call_site_htab (htab_up call_site_htab)
{
gdb_assert (m_call_site_htab == nullptr);
- m_call_site_htab = call_site_htab;
+ m_call_site_htab = call_site_htab.release ();
}
/* See symtab.h. */
@@ -494,6 +494,16 @@ compunit_symtab::forget_cached_source_info ()
s->release_fullname ();
}
+/* See symtab.h. */
+
+void
+compunit_symtab::finalize ()
+{
+ this->forget_cached_source_info ();
+ if (m_call_site_htab != nullptr)
+ htab_delete (m_call_site_htab);
+}
+
/* The relocated address of the minimal symbol, using the section
offsets from OBJFILE. */