Roland Mainz wrote: > Nicolas Williams wrote: > > On Wed, Feb 18, 2009 at 07:42:29PM +0100, Roland Mainz wrote: > > > Nicolas Williams wrote: > > > > I strongly recommend that ksh93/AST on Solaris use the standard > > > > allocator, OR, if you insist on having a private allocator, that it > > > > provide an allocator with standard names, so that: a) it interposes upon > > > > libc's, b) remains interposable. > > > > > > The problem with |libc::malloc()| was that it isn't useable in ksh93's > > > case: > > > 1. |libc::malloc()| suffers from excessive fragmentation issues for > > > long-running scripts. It simply doesn't stop growing the heap. > > > > I am not sure that's true, but you should try libumem -- if it works > > then link with libumem. If no Solaris allocator works well enough then > > use your own BUT DO NOT prefix the symbol names with _ast_ or anything > > else -- let your allocator interpose on the system one so as to avoid > > multiple allocators in one process. > > AFAIK this will not work properly if someone uses libumem via LD_PRELOAD > since libumem&co. are not async-signal safe and ksh93 relies on this > feature.
BTW: Jenny came up with a simple solution: We can do _both_: 1. We use the libast allocator as normal (e.g. |libast::_ast_malloc()|) and 2. Add a small source which contains |malloc()|&co. (and calls the matching libast functions (e.g. |libast::_ast_malloc()|)) and matching (interposing) entries in libast's "mapfile-vers" (note that we AFAIK cannot use mapfile redirects together with interposing - to keep it simple we use a simple C source to do the "redirect"). This allows that only one allocator (the libast one) is used by default (which saves some memory and improves performance) but people may override this for the default |malloc()|&co. functions but avoids overriding the async-signalsafe libast functions in the codepaths which needs them. ---- Bye, Roland P.S.: Is there any RFE yet to make |libc::malloc()|&co. async-signal-safe ? -- __ . . __ (o.\ \/ /.o) roland.mainz at nrubsig.org \__\/\/__/ MPEG specialist, C&&JAVA&&Sun&&Unix programmer /O /==\ O\ TEL +49 641 3992797 (;O/ \/ \O;)