http://bugs.winehq.org/show_bug.cgi?id=16023
--- Comment #19 from Alexandre Julliard julliard@winehq.org 2008-12-27 08:29:46 --- (In reply to comment #18)
The main reason the reservation code is still disabled on FreeBSD is because mmap(NULL) only tries addresses after the executable + some malloc heap space. Wine is located at 0x7bf00000. The heap size is currently set to 0x02000000 by the wine-freebsd loader, which is thought to be the absolute minimum required to support FreeBSD 6, where malloc doesn't fall back on mmap if it runs out of this heap space. It's not enough to run certain games for instance. Although I suspect there are memory leaks in certain DRI drivers, these games do run with a much larger heap space, like 512MiB. Anyway, so mmap(NULL) looks for free memory after about 0x7e000000. If you reserve everything beyond the 2GiB user space limit, that means there's about 32MiB left for all mmap(NULL) calls that might exist in code outside Wine, like for instance the ELF loader. A large portion of that 32MiB is already taken by DSOs.
Yes, but the point is that we don't want DSOs (at least not the Wine ones) to end up above 0x80000000, that's why we have the reservation code, and that's why it needs to be enabled on FreeBSD too. If there isn't enough space for DSOs below 0x80000000 this needs to be fixed.