From: Simon Marchi <simon.marchi@ericsson.com>
To: Tom Tromey <tom@tromey.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Replace psymbol_allocation_list with std::vector
Date: Sat, 14 Oct 2017 03:02:00 -0000 [thread overview]
Message-ID: <112a72c3-bc3e-1c2a-c108-a4ff19146902@ericsson.com> (raw)
In-Reply-To: <87k1zypxdk.fsf@tromey.com>
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))
next prev parent reply other threads:[~2017-10-14 3:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-13 13:58 Simon Marchi
2017-10-13 21:03 ` Tom Tromey
2017-10-13 21:10 ` Tom Tromey
2017-10-14 3:02 ` Simon Marchi [this message]
2017-10-14 4:50 ` Tom Tromey
2017-10-14 12:09 ` Simon Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=112a72c3-bc3e-1c2a-c108-a4ff19146902@ericsson.com \
--to=simon.marchi@ericsson.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox