jemalloc win32 port

Yoni Londner yoni at
Tue Feb 14 09:10:35 PST 2012

Hi again,

Well, I did not get any response, so I had to complete the work alone.
I am attaching a patch for a fully working version of jemalloc for msvc.
We are using this version for about a week, and it looks pretty good so far.
As I mentioned in my last email, I really hope that this patch will be 
committed to git.
Comments/suggestions are more than welcome


On 31/1/2012 12:25, Yoni Londner wrote:
> Hi,
> I am working with Firefox version of jemalloc (x86 and x64), And it is 
> working as expected.
> But, I wanted to use the original version of jemalloc, mainly because 
> there are profiling features missing
> in Firefox's version, and because I wanted to be able to get bug fixes 
> and new features from TRUNK.
> So, I Ported jemalloc to win32 (using msvc10 on win7 x86)
> I did not completed all the work (yet), but i have a working version.
> These are the changes I made (patch attached):
>  * prn.h - apparently it is not possible to create a file named
>    on windows. I changed the name of the file to _prn.h
>  * atomic.h - added win32 intrinsic implementation
>  * compat_win32.h - all sort of definitions needed for win32 (most of
>    them from Firefox version + pthread handling - not completed yet)
>  * compat_win32.c - need to complete here win32_setspecific and
>    win32_setspecific by using ".CRT$XXX"
>  * arena.c, ctl.h, ctl.c, ckh.c - C99 compatibility
>  * hunk_mmap.c
>  * jemalloc_defs.h, jemalloc.h, jemalloc_internal.h - I don't have
>    configure, so I copied and hand edited it.
>  * mutex.h - win32 mutex (from Firefox version)
>  * chunk_mmap.c -pages_map/pages_unmap from Firefox version
>  * jemalloc.c - system settings (ncpus etc) + added _crtheap
>  * jemalloc.c - win32 crt specific functions (msize, calloc_impl,
>    _recalloc, get_heap_handle...)
> since jemalloc does not patch malloc and friends, I need to use a 
> striped version of msvcrt (removed malloc/free etc).
> I have a scripts to do this.
> I hope that after the work is done, you can commit this patch to the git.
> Any comments/suggestions/help are welcome
> Yoni.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jemallooc_win32.patch
URL: <>

More information about the jemalloc-discuss mailing list