jemalloc win32 port

Jason Evans jasone at
Wed Feb 29 13:41:13 PST 2012

I looked through your patch and found numerous issues that would make it a lot of work to integrate, some of which Mike Hommey pointed out.  The real non-starter though is that it uses hand-edited versions of the * header files.  That's not a maintainable solution.  I don't regularly use Windows, and even if I integrated this patch, the Windows support would be sure to break almost immediately due to innocuous changes.


On Feb 14, 2012, at 9:10 AM, Yoni Londner wrote:
> 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
> Yoni.
> 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.
> <jemallooc_win32.patch>_______________________________________________
> jemalloc-discuss mailing list
> jemalloc-discuss at

More information about the jemalloc-discuss mailing list