http://bugs.winehq.org/show_bug.cgi?id=23318
--- Comment #12 from jhgf bernhardloos@googlemail.com 2011-10-01 14:21:05 CDT --- Created attachment 36637 --> http://bugs.winehq.org/attachment.cgi?id=36637 release the reserved address space until it's actually needed
Turns out I had a bunch of holes in my understanding of how exactly wine reserves virtual address space ... Anyway, the main problem is, that this app uses LoadLibrary to open most of it's dependencies (dinput, opengl, winmm and a few more), instead of linking directly against them and ld maps them all over the place. The attached patch fixes this by deferring the release of the reserved until a mmap call fails with ENOMEM. For this, it's necessary to hook mmap. Also, malloc calls still end up using the mmap in glibc directly and will fail if the unreserved memory runs out, but this doesn't seem to be a problem compared to mmap. A solution would be to hook malloc in the same way as mmap.