This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Where is free() implemented?


On 05/24/2016 02:47 PM, Preston Moore wrote:
> Hey everyone,
> 
> Hopefully this is a quick question with a quick answer. Where is
> free() implemented? Iâve just found a bunch of extern references in
> the glibc source I have. This is Ubuntu 14.04 LTS 32 bit.

In most GNU/Linux applications the function free() is implemented in
the shared library libc.so.6 (part of glibc) and is part of the memory 
allocation API provided by the core runtime. The functionality of free
is defined in the ISO C standard.

However, the memory allocation API is designed to be "replaceable"
via what is called "ELF symbol interposition" which means you can load
another shared library via LD_PRELOAD and have that shared library
provide a replacement implementation of the API. This is the case when
you're using other memory allocation libraries like jemalloc, tcmalloc, 
or hoard.

-- 
Cheers,
Carlos.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]