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: Custom malloc/mmap for x86_64


On Sat, Apr 28, 2012 at 1:34 PM, Daniel <lbathen@gmail.com> wrote:

> I apologize, this might sound confusing, we want to allow programmers
> the option of using traditional malloc and our malloc. So we will
> be using the same structures, etc., malloc uses. But if a programmer who
> is not aware of the library or does not care about memory types, can
> still use malloc. If he cares about the memory type, then he can use our
> my_malloc. We simplify things for the programmer by enhancing glibc with
> our my_malloc.

The goals outlined above are served *perfectly* well by you providing
an extra library, which implements my_malloc. Therefore it is still
entirely unclear why you want to put my_malloc into glibc.

A programmer who doesn't care, doesn't link your library.

A programmer who does care, links your library and calls my_malloc.

A programmer who does care, and wants to redirect all malloc() calls
to your library, links against your library, and also adds the
following piece of code (or you could put it into a special
lib_redirect_all_malloc_to_my_malloc):

  void *malloc(size_t sz) { return my_malloc(sz); }


Hope this helps,
-- 
Paul Pluzhnikov


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