http://bugs.winehq.org/show_bug.cgi?id=35256
Bug ID: 35256 Summary: Skyrim - "Not enough memory to run application" error Product: Wine Version: 1.7.8 Hardware: x86-64 OS: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: micferg78@gmail.com Classification: Unclassified
Created attachment 47022 --> http://bugs.winehq.org/attachment.cgi?id=47022 Wine identifies 200MB out of 30GB of available userland memory
Occasionally when attempting to run Skyrim (or other memory intensive programs) through Wine on OS X, a "Memory Error: Not enough memory to run application" popup will appear and the program will exit.
Simple workarounds: logging out and back in, rebooting.
I believe this is caused by GlobalMemoryStatusEx() in kernel32/heap.c returning wildly incorrect values (see the attached log for an example from a system with 32GB of memory - most of it available).
On OS X and BSDs, GlobalMemoryStatusEx() still gets the total system memory (ullTotalPhys) by asking sysctl() for the value of HW_PHYSMEM, which is capped at 2GB. The available system memory (ullAvailPhys) is determined by asking sysctl() for HW_USERMEM, which is also apparently 32-bit and overflows dreadfully. On OS X, Wine temporarily stores both values in an unsigned int.
I recompiled kernel32.dll.so using HW_MEMSIZE in place of HW_PHYSMEM and a kludged value for ullAvailPhys; Skyrim now runs reliably. The example patch will also be attached for anyone who can reproduce this issue.