This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC 1/2] Adding custom destructor for free.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 19 Nov 2013 12:09:27 +0100
- Subject: Re: [RFC 1/2] Adding custom destructor for free.
- Authentication-results: sourceware.org; auth=none
- References: <20131111142049 dot GA13002 at domone dot podge> <528B3D87 dot 606 at redhat dot com>
On Tue, Nov 19, 2013 at 11:29:27AM +0100, Florian Weimer wrote:
> On 11/11/2013 03:20 PM, OndÅej BÃlka wrote:
>
> >I wonder if this would be a core functionality or by adding new
> >library?
>
> There are already libraries for doing this. Adding it to libc would
> only help if the existing (incompatible) libraries would standardize
> on the libc interfaces, which seems unlikely.
>
Could you provide links? Do they require to use other function than free
which makes them less flexible?
I want to know what features they offer and what could be standardized.
A custom free here is more a prerequisite for other features.
> I also think it's hardly radical enough, given that it negatively
> interacts with malloc hooking.
>
Not necceassarily. I could make these features working on arbitrary
allocator with small slowdown. A custom allocator could get these
features by -lmalloc_intercept which would handle these for him.
Alternatively when allocator is LD_PRELOADED then use
LD_PRELOAD=libmalloc_intercept.so:allocator.so
Doing this would help as already you cannot expect malloc_hook work
with custom allocator.
Then there is a hack, that we could make linker prepend LD_PRELOAD with
intercept library which would work always but is ugly.