This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Replace psymbol_allocation_list with std::vector


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))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]