public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: binutils/2467: "ar q" / ranlib has large memory use (linear in archive size)
@ 2006-03-21  6:03 H. J. Lu
  2006-03-24  4:11 ` Alan Modra
  0 siblings, 1 reply; 5+ messages in thread
From: H. J. Lu @ 2006-03-21  6:03 UTC (permalink / raw)
  To: binutils; +Cc: dcoutts

Do we need the objalloc memory for the archive members after
_bfd_compute_and_write_armap is called? If not, we should be able
to free all the objalloc memory in _bfd_generic_bfd_free_cached_info.
Will this patch break anything?


H.J.
---
2006-03-21  Duncan Coutts <dcoutts@gentoo.org>
	    H.J. Lu  <hongjiu.lu@intel.com>

	PR binutils/2467
	* libbfd-in.h (_bfd_generic_bfd_free_cached_info): Make it a
	function prototype.
	* libbfd: Regenerated.

	* opncls.c (_bfd_generic_bfd_free_cached_info): New.

--- bfd/libbfd-in.h.cached	2006-03-16 12:37:43.000000000 -0800
+++ bfd/libbfd-in.h	2006-03-20 18:07:14.000000000 -0800
@@ -155,6 +155,8 @@ bfd * _bfd_new_bfd
   (void);
 void _bfd_delete_bfd
   (bfd *);
+bfd_boolean _bfd_generic_bfd_free_cached_info
+  (bfd *);
 
 bfd_boolean bfd_false
   (bfd *ignore);
@@ -214,7 +216,6 @@ int bfd_generic_stat_arch_elt
    BFD_JUMP_TABLE_GENERIC (_bfd_generic).  */
 
 #define _bfd_generic_close_and_cleanup bfd_true
-#define _bfd_generic_bfd_free_cached_info bfd_true
 #define _bfd_generic_new_section_hook \
   ((bfd_boolean (*) (bfd *, asection *)) bfd_true)
 extern bfd_boolean _bfd_generic_get_section_contents
--- bfd/opncls.c.cached	2006-03-16 12:37:43.000000000 -0800
+++ bfd/opncls.c	2006-03-20 18:11:54.000000000 -0800
@@ -120,6 +120,24 @@ _bfd_delete_bfd (bfd *abfd)
   free (abfd);
 }
 
+/* Free objalloc memory.  */
+
+bfd_boolean
+_bfd_generic_bfd_free_cached_info (bfd *abfd)
+{
+  bfd_hash_table_free (&abfd->section_htab);
+  objalloc_free ((struct objalloc *) abfd->memory);
+
+  abfd->sections = NULL;
+  abfd->section_last = NULL;
+  abfd->outsymbols = NULL;
+  abfd->tdata.any = NULL;
+  abfd->usrdata = NULL;
+  abfd->memory = NULL;
+
+  return TRUE;
+}
+
 /*
 SECTION
 	Opening and closing BFDs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-04-25 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-21  6:03 PATCH: binutils/2467: "ar q" / ranlib has large memory use (linear in archive size) H. J. Lu
2006-03-24  4:11 ` Alan Modra
2006-03-24  7:27   ` H. J. Lu
2006-04-07  1:08     ` H. J. Lu
2006-04-25 17:22       ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).