jemalloc win32 port
mh at glandium.org
Thu Feb 16 07:14:35 PST 2012
On Tue, Feb 14, 2012 at 07:10:35PM +0200, 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
Just a few comments after a quick glance. (Please note that I'm not a
- I don't see anything using your pseudo random generator, so you
probably can just skip prn.h altogether.
- It's confusing to mix porting changes and unrelated changes, like
For what it's worth, Mozilla has been patching jemalloc to work on win32
for quite some time now, and I'm going to refresh the copy used in
Firefox to use a much more recent jemalloc. In the process of doing so,
I'll obviously have to forward-port our win32 code, and/or borrow yours.
I guess I'll come back when I have something ready.
> 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 prn.xxx
> > 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 jemalloc_internal.h.in 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: <http://jemalloc.net/mailman/jemalloc-discuss/attachments/20120214/d0275685/attachment-0001.ksh>
More information about the jemalloc-discuss