https://bugs.winehq.org/show_bug.cgi?id=34658
--- Comment #19 from Gabriel Corona gabriel.corona@enst-bretagne.fr --- TLDR: my patch is a hack which might break other programs (I did not even bother to remove clearly the lines of codes bur horribly commented them out :/)
Wylda: Yes, the patch is a quick hack and might trigger some warnings :)
David: It's not merged because this patch is a hackish workaround which might break other programs.
By default Windows, 32-bit processes can use only the lower 2GiB of virtual memory. AFAIU, this is for compatibility/historical reason: some Windows programs may not work correctly with addresses above this limit (and ssumte they may be invalid or something).
Apparently, 2GiB is not enough for running Bioshock 2 on Wine in some cases: maybe it's because the OpenGL drivers use more virtual memory, maybe it's because some virtual memory is not properly deallocated, etc.
Windows .exe files can include a IMAGE_FILE_LARGE_ADDRESS_AWARE bit which removes this limitation: when this flag is set, a process can use more than 2GiB of virtual memory.
The patch enforces the IMAGE_FILE_LARGE_ADDRESS_AWARE behaviour on all processes. Biosock 2 can now use more than 2GiB of memory. This is a hack and you might not want this by default in a standard wine compilation because it might break programs which are not prepared to handle memory above the 2GiO limit. (In practice, I'm using this patch the time and I did not find any crash linked to this hack.)
The patch was intended as a quick workaround and proof of concept showing that the crash was due to do an exhaustion of the 2GiB virtual memory and not really to be merged (in its current form) in Wine source code.
Now what's needed is to find why this memory exhaustion is happening in the first place and try to fix that if possible. If a IMAGE_FILE_LARGE_ADDRESS_AWARE-enforcement feature is to be merged it should probably be optional (and disabled by default).