[erlang-patches] win32 memory allocation fix / mmap emulation

Björn Gustavsson <>
Fri Dec 11 07:35:42 CET 2009

On Fri, Dec 11, 2009 at 2:36 AM, Blaine Whittle <> wrote:
> This patch attempts to address the win32 memory fragmentation / OMM problem.

Thanks! I have included the current version in 'pu' so that it can be
tested and reviewed.

For the next version of the patch, I would want most of the
information in your email
in the commit message itself.

>  Additionally the link step now uses LARGEADDRESSAWARE which flags the OS to allocate 3 gigs of VM to the process instead of the standard 2 (XP requires a small config change to use it, but newer OS's should be fine.  Google "largeaddressaware 3g" for more info).

Will an emulator built in that way work on Windows XP without the config change?

If the answer is no, this change should be made optional and possible
to enable using a configure option.
If this change is totally separate from the other changes, it would be
best to split it out into a separate
commit (on the same branch).

> I left this part of the build manual as I'm unsure exactly where the defines should be placed (i.e. either standard windows defines in erl_win_sys.h, a change to the compiler params in the win32 makefile , or via a change to the configure script).

I cannot give you a definite answer about this yet. I'll have to
consult to consult
with the experts on Windows and the memory manager.

My gut feeling, though, is that lying about Windows having MMAP might
not be the best way to
got, as MMAP could possibly be used in other places in a future
version of OTP. So it may be
better to change the memory management code to test some other define
that covers both the
mmap() case and the virtual allocation functions on Windows. (For ease
of reviewing, it would
be a good idea to put such re-factoring into a separate commit.)

Assuming that this patch works well, will there be any reason for
someone wanting to turn it off?
If the answer is yes, there should be a configure option to do that.

Björn Gustavsson, Erlang/OTP, Ericsson AB

More information about the erlang-patches mailing list