Subj : Re: memory management in jsref To : Aleksey From : Brendan Eich Date : Thu Jul 29 2004 07:36 pm Aleksey wrote: > Hello, > > To increase the performance (speed) of jsref on windows platform I use > not standard memory manager (Doug Lea's Malloc, > http://gee.cs.oswego.edu/dl/html/malloc.html). Performance speed is > definitely improved and everything looks fine but I still have a > slight doubts. > > When I was inserting dlmalloc to the engine, I noticed that somewhere > the engine uses malloc/free functions and in some other places it uses > JS_malloc/JS_free which in their turn use same malloc/free. > I was wondering if jsref follows any well-defined memory policy? Yes -- everything is layered on one malloc/realloc/calloc/free implementation. It doesn't matter whether you JS_malloc and then free, or malloc (with your own error check, calling JS_ReportOutOfMemory) and then JS_free (although that is odd, because JS_free adds little value (just null defense). If you are trying to change JS_malloc and JS_free to call something else, that's the wrong path. You need to *link* with a different libleamalloc.a or .so (Unix), or whatever, that exports the standard symbols malloc, free, etc. /be .