jemalloc win32 port

Yoni Londner yoni at hola.org
Sun Feb 19 00:46:41 PST 2012


Hi Mike,

>  - I don't see anything using your pseudo random generator, so you
>   probably can just skip prn.h altogether.

You are right, but I think its better to change its name, so we an to use it in the future.
It took me a while to understand why the tar.gz didn't open correctly on my machine, and I didn't want anyone else to spend time on this error.

>  - It's confusing to mix porting changes and unrelated changes, like
>   abort->xabort.

Again, you are right. I am porting jemalloc as part of a bigger project, 
and its hard to separate the changes.
On the other hand, they are all good changes (I think), and they make 
jemalloc better.

>  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.

Mozilla's code is not only a snapshot of a very old version of jemalloc, 
but its also a totally stripped down version, missing a huge amount of 
features of configurability, debugging and profiling available in jemalloc.
I think its much better to port jemalloc as-is, and then to get the 
changes with no added work need to be done every time.

Yoni.

On 16/2/2012 17:14, Mike Hommey wrote:
> 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
> jemalloc developer)
>
> - 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
>    abort->xabort.
>
> 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.
>
> Cheers,
>
> Mike
>
>> 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 mailing list