Why win32 application under Wine can allocate only 2000 MB of memory, but same programm translated by gcc can get 3800 MB. (OS/Compilers - WinXP/Visual C 6.0 32 bit, and openSUSE 11 x64/gcc -m32) #include <stdlib.h> #include <stdio.h> #include <time.h> main(int argc, char **argv) {unsigned long n,m,i; int *p,*p1,*p2,*p3; clock_t time1,time2; i=4095; if (argc == 2) i = (size_t) strtoul(argv[1], NULL, 0); m=i*1024*1024; while( (p=(int*)malloc(m)) ==0 ) m-=1024l*1024l; printf("Allocated %u MB ( %u bytes )\n",m/1024l/1024l,m); getchar(); free(p); exit(0); }
Adept wrote:> Why win32 application under Wine can allocate only 2000 MB of memory,Correct, that's all you get with 32-bit windows. Everything else reserved for the system.
Gert van den Berg wrote:> On Tue, Jul 22, 2008 at 7:18 AM, vitamin <wineforum-user at winehq.org> wrote: > > > > > Adept wrote: > > > > > Why win32 application under Wine can allocate only 2000 MB of memory, > > > > > > > > > Correct, that's all you get with 32-bit windows. Everything else reserved for the system. > > > > Actually up to 3GB in certain cases under Windows NT 5.x... > http://www.microsoft.com/whdc/system/platform/server/PAE/PAEmem.mspx > > Gert van den BergBTW, PAE options supported and Windows XP. I think, it's bad idea for Wine, to emulate Windows limitations. If Wine+linux can give more memory to my application, it's good reason (for me, as Windows user) to format Windows and install Linux+Wine.
It's written in a comment that this 3GB limit is a Windows limit, so maybe it's from the the Win9x memory layout (http://support.microsoft.com/kb/q125691/). I don't know why the 3GB would be special in the NT memory layout. I would need to check that but I think we can change this in NT mode. It would be best to take the vmsplit value from the kernel, but I don't know yet how it can be queried at runtime.> > Windows XP x86 will not use the full 4GB (as a total address space for > all processes) even if PAE is enabled since Service Pack 2... >It's getting a bit off-topis, but AFAIK the PAE was enabled in SP2 only because it is required to use the NX bit (no-execute memory, a.k.a. XD, DEP). To have true PAE support you need to have Windows Server Enterprise (or a 64-bit OS).