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

Francois Gouget fgouget at codeweavers.com
Wed Mar 18 10:36:29 CDT 2009


Tijl Coosemans a écrit :
> 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.)

Which games can be used to reproduce this issue? Is one of them freely 
downloadable? Even better, can this issue be reproduced with a non-game 
application?

Also, won't this patch be obsolete once Alexandre completes his current 
OpenGL memory allocation work? That is, doesn't it just hide the problem 
rather than solving it?


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

This bug mentions the following error:
 > Fatal error 'Cannot allocate red zone for initial thread' at line 384
 > in file /usr/src/lib/libthr/thread/thr_init.c (errno = 2)

It would be nice to figure out how we get in init_main_thread(). 
Apparently there are only two possible cases:
  *   1) Some thread routines have detected that the library hasn't yet
  *      been initialized (_thr_initial == NULL && curthread == NULL), or
  *
  *   2) An explicit call to reinitialize after a fork (indicated
  *      by curthread != NULL)

I don't really understand why we would reallocate the stack in the first 
case so my guess is this happens through a fork.


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

Isn't the memory reservation supposed to prevent Unix libraries from 
being mapped in this memory range? If so, won't leaving holes open us to 
this sort of trouble again?

Also, besides FreeBSD's braindead stack allocation routines, why should 
this patch only be used on FreeBSD? If it's supposed to help with OpenGL 
memory allocation then shouldn't it be used on Linux too (which has the 
same issue with OpenGL)?


-- 
Francois Gouget
fgouget at codeweavers.com




More information about the wine-patches mailing list