Subject: Re: posix_memalign vs USE_JEMALLOC
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-userlevel
Date: 11/26/2007 22:40:47
In article <200711232224.XAA0000143647@zel459.zel.kfa-juelich.de>,
Matthias Drochner  <M.Drochner@fz-juelich.de> wrote:
>
>Hi -
>it seems that one can't just switch the malloc() implementation
>anymore to compare or track down user program problems: jemalloc
>provides posix_memalign(), and userlevel programs are picking
>it up, while phkmalloc doesn't support it.
>So what to do --
>-implement a (probably less effective) posix_memalign() on phkmalloc,

That is pretty difficult to do. I looked into it, and it could be
done if alignment < pagesize and we always allocate new pages for
posix_memalign calls. This will make us run out of memory soon :-(

>-add an option to jemalloc to desist from using memory above sbrk()
> which might be enough to check whether this is a problem for
> the user program, and/or

Programs that make assumptions about the arenas allocated are buggy
by default, and should be using their own allocator.

>-state that phkmalloc is depreciated and no binary compatibility
> can be expected

Programs who use posix_memalign must use jemalloc... We could provide
a stub in phkmalloc that just aborts, but this will just make things
worse.

christos