aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-12-08 21:27:27 +1030
committerAlan Modra <amodra@gmail.com>2024-12-12 16:04:51 +1030
commit2b76d69e57a44a524a675edc957ee795a52dd34c (patch)
tree3b24397984376f03c83ec5d23a7200f41bd7b137
parent6f0ab551876087d8bcce55beb55e58d72ae78d98 (diff)
downloadbinutils-2b76d69e57a44a524a675edc957ee795a52dd34c.zip
binutils-2b76d69e57a44a524a675edc957ee795a52dd34c.tar.gz
binutils-2b76d69e57a44a524a675edc957ee795a52dd34c.tar.bz2
nm.c free_lineno_cache
free_lineno_cache frees symbol and relocation data used when displaying line number info for symbols (nm -l). Currently that is done when closing the bfd, but that's not ideal for archives since that results in two bfds worth of memory in use. * nm.c (display_rel_file): Call free_lineno_cache here.. (display_archive, display_file): ..not here.
-rw-r--r--binutils/nm.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/binutils/nm.c b/binutils/nm.c
index 2546dc5..87e8305 100644
--- a/binutils/nm.c
+++ b/binutils/nm.c
@@ -1498,8 +1498,8 @@ display_rel_file (bfd *abfd, bfd *archive_bfd)
else
print_size_symbols (abfd, dynamic, symsizes, symcount, archive_bfd);
- if (synthsyms)
- free (synthsyms);
+ free_lineno_cache (abfd);
+ free (synthsyms);
free (minisyms);
free (symsizes);
}
@@ -1602,7 +1602,6 @@ display_archive (bfd *file)
if (last_arfile != NULL)
{
- free_lineno_cache (last_arfile);
bfd_close (last_arfile);
if (arfile == last_arfile)
return;
@@ -1611,10 +1610,7 @@ display_archive (bfd *file)
}
if (last_arfile != NULL)
- {
- free_lineno_cache (last_arfile);
- bfd_close (last_arfile);
- }
+ bfd_close (last_arfile);
}
static bool
@@ -1656,7 +1652,6 @@ display_file (char *filename)
retval = false;
}
- free_lineno_cache (file);
if (!bfd_close (file))
retval = false;