From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Subject: Re: [PATCHv2] libelf: Return already gotten Elf_Data from elf_getdata_rawchunk
Date: Tue, 05 Apr 2022 15:13:24 +0200 [thread overview]
Message-ID: <189f86f680da2b0a0803bdd2871da96e1fde3775.camel@klomp.org> (raw)
In-Reply-To: <20220401141525.3384-1-mark@klomp.org>
Hi,
On Fri, 2022-04-01 at 16:15 +0200, Mark Wielaard wrote:
> elf_getdata_rawchunk keeps a list of Elf_Data_Chunk to track which
> Elf_Data structures have already been requested. This allows elf_end
> to clean up all internal data structures and the Elf_Data d_buf if
> it was malloced.
>
> But it didn't check if a chunk was already requested earlier. This
> meant that if for example dwelf_elf_gnu_build_id was called multiple
> times to lookup a build-id from the phdrs a new Elf_Data_Chunk was
> created. This could slowly leak memory.
>
> So also keep track of the offset from which the size and type of
> the rawdata was requested so we can return existing data if it is
> requested multiple times.
>
> Note that the current cache is a simple linked list but the chain
> is normally not that long. It is normally used to get chunks from
> the phdrs, and there are normally less than 10.
I pushed this.
Cheers,
Mark
prev parent reply other threads:[~2022-04-05 13:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 14:15 Mark Wielaard
2022-04-05 13:13 ` Mark Wielaard [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=189f86f680da2b0a0803bdd2871da96e1fde3775.camel@klomp.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.org \
/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).