public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Kevin Nomura <nomura@netapp.com>
Cc: binutils@sourceware.org
Subject: Re: memory usage with large debug sections
Date: Mon, 10 Apr 2006 17:10:00 -0000	[thread overview]
Message-ID: <443A809F.4090006@redhat.com> (raw)
In-Reply-To: <20060405020342.GG9379@netapp.com>

Hi Kevin,

> if ((sec->flags & SEC_RELOC) != 0)
> {
> 	size_t ext_size;
> 
> 	ext_size = elf_section_data (sec)->rel_hdr.sh_size;
> 	if (ext_size > max_external_reloc_size)
> 	max_external_reloc_size = ext_size;
> 	if (sec->reloc_count > max_internal_reloc_count)
> 	max_internal_reloc_count = sec->reloc_count;
> }
> 
> Is it really the case that the size of a debug section has
> to be used to calculate the malloc size for these relocation
> structures?

No, but this size is guaranteed to be safe - there can never be more 
relocs in a debug section than if the entire section held relocs and 
nothing else.

If you would like to try to improve this code you could write a function 
to count the number of relocs in the debug section and then use this 
figure in the malloc.

Cheers
   Nick


      reply	other threads:[~2006-04-10 16:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-05  2:03 Kevin Nomura
2006-04-10 17:10 ` Nick Clifton [this message]

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=443A809F.4090006@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=nomura@netapp.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).