Problems with VirtualAlloc/Lock

Alexandre Julliard julliard at winehq.org
Tue Mar 15 03:09:57 CST 2005


Michael Ost <most at museresearch.com> writes:

> Yep, it does. Give it a try. As far as I can tell:
> 
> int total = 0;
> for (;;) {
>   LPVOID* leak = ::VirtualAlloc(NULL, 1048576, 
>     MEM_RESERVE, PROT_NOACCESS);
>   if (leak) {
>     total += 1048576/1024;
>     printf("Allocated %ldk\r", total);
>   }
>   else {
>     printf("\n");
>     PrintWindowsError("VirtualAlloc", ::GetLastError();
>     break;
>   }
> }
> 
> will stop at 1,022,976k (1GB) on any wine machine. In winxp it goes up
> to 2GB, as it ought to. 

That's a kernel limitation. If you hack the kernel to start allocating
from lower addresses (or implement the syscall we discussed to let us
specify the mmap range) you can get the full 2GB.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list