libwine: Only partially reserve memory beyond 0x80000000 on FreeBSD.

Tijl Coosemans tijl at ulyssis.org
Wed Mar 18 07:19:07 CDT 2009


After enabling the memory reservation code on FreeBSD last week,
several games either suffer a performance loss or simply crash, often
with GL_OUT_OF_MEMORY errors or similar out of memory errors from X
libs. (Tested with nvidia driver and opensource r300 dri driver.)

It also causes other problems like:
http://bugs.winehq.org/show_bug.cgi?id=17718

This patch only partially reserves memory, enough for the shared heap,
virtual heap and wine top-down allocations, and leaves the majority
unreserved.


---
 libs/wine/mmap.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

-------------- next part --------------
diff --git a/libs/wine/mmap.c b/libs/wine/mmap.c
index d107fc7..a694e4f 100644
--- a/libs/wine/mmap.c
+++ b/libs/wine/mmap.c
@@ -344,9 +344,13 @@ void mmap_init(void)
     struct reserved_area *area;
     struct list *ptr;
 #ifdef __i386__
+    char *user_space_limit = (char *)0x7ffe0000;
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+    reserve_malloc_space( 8 * 1024 * 1024 );
+    reserve_area( user_space_limit, (char *)0x82000000 );
+#else
     char stack;
     char * const stack_ptr = &stack;
-    char *user_space_limit = (char *)0x7ffe0000;
 
     reserve_malloc_space( 8 * 1024 * 1024 );
 
@@ -377,6 +381,7 @@ void mmap_init(void)
         reserve_area( base, end );
     }
     else reserve_area( user_space_limit, 0 );
+#endif
 #endif /* __i386__ */
 
     /* reserve the DOS area if not already done */


More information about the wine-patches mailing list