[PATCH] Replace psymbol_allocation_list with std::vector
Simon Marchi
simon.marchi@ericsson.com
Sat Oct 14 03:02:00 GMT 2017
On 2017-10-13 05:10 PM, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@ericsson.com> writes:
>
> Simon> psymbol_allocation_list is basically a vector implementation. We can
> Simon> replace it with an std::vector, now that objfile has been C++-ified.
>
> I think this is very nice.
>
> I wonder how worthwhile it would be to call shrink_to_fit on the vectors
> in require_partial_symbols.
It can't really hurt. Since those lists are not expected to change after that
point, it seems useless to keep the extra unused memory in the vector. I would
apply this fixup to my patch, WDYT?
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 36ae83a..762f9ce 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -86,6 +86,12 @@ require_partial_symbols (struct objfile *objfile, int verbose)
gdb_flush (gdb_stdout);
}
(*objfile->sf->sym_read_psymbols) (objfile);
+
+ /* Partial symbol lists are not expected to changed after this
+ point, get rid of the unused memory. */
+ objfile->global_psymbols.shrink_to_fit ();
+ objfile->static_psymbols.shrink_to_fit ();
+
if (verbose)
{
if (!objfile_has_symbols (objfile))
More information about the Gdb-patches
mailing list