Startux.de

Wine patch to use 3GB userspace PDF Print E-mail
  
Thursday, 28 August 2008 10:31

Playing Everquest 2 using Wine, I suffered from the more and more often occurring "out of memory" crashes especially in new zones like RoK or TSO. After reading in the EQ2 forums about various remedies for Windows using the /3GB switch in boot.ini, I looked into Wine wether this could be done with linux too.

Wine is actually ware of the so called LARGEADDRESSAWARE flag, but these "out of memory" errors seem to originate from the nvidia or ati opengl driver allocationg texture memory. It is reserved directly within the driver via the C API and therefore not taken into account by wine.

The current Wine preallocates all memory between 2 and 4GB of the virtual address space in order to simulate the windows memory model. The OpenGL driver apparently can only get the memory below 2GB and therefore only 2GB are available for both, the application and the opengl textures.

The following hack modifies the preallocation to only block memory between 3 and 4GB. This probably leads to a slightly wrong memory model compared to a native Windows, but it gives at least EQ2 1GB more memory to be used by the OpenGL driver.

Since using this patch I have never seen any crash concerning "out of memory" anymore.

After all this is just a temporary workaround for the problem described in http://bugs.winehq.org/show_bug.cgi?id=13335, which will hopefully be fixed soon and my workaround is not needed anymore.

See U in Norrath ;-)

diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c
index ff117cc..c4e1446 100644
--- a/libs/wine/mmap.c
+++ b/libs/wine/mmap.c
@@ -346,7 +346,8 @@ void mmap_init(void)
 #if defined(__i386__) && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__)  /* commented out until FreeBSD gets fixed */
     char stack;
     char * const stack_ptr = &stack;
-    char *user_space_limit = (char *)0x7ffe0000;
+    char *user_space_limit = (char *)0xbffe0000;
+    // char *user_space_limit = (char *)0x7ffe0000;
 
     reserve_malloc_space( 8 * 1024 * 1024 );
 
Last Updated ( Wednesday, 14 January 2009 11:22 )
 
Comments (1)
thanks!
1 Tuesday, 21 July 2009 05:41
Zack
Thank you! This seems to have fixed my World of Warcraft GL_OUT_OF_MEMORY problem! I'm posting a patched .deb on the Ubuntu Forums at http://ubuntuforums.org/showthread.php?p=7650658#post7650658. So glad that I don't have to reduce my RAM/install a different OS to fix it!

Add your comment

Your name:
Subject:
Comment:
Copyright © 2010 Startux.de. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.