I've got a simple (32bit) windows application (compiled in Borland c++ builder): int *p; while(1) { p = new int[10000000]; //allocates 40 MB of memory } on Windows XP it crashes after 50 iterations (i.e. 2 GB allocated) but on wine it crashes after 30 iterations (1200 MB allocated) is it impossible to use 2gb of memory in wine? why only 1.2GB is available? I've got wine 0.9.13, linux 2.4 (2.6 doesn't make any difference), 2.5GB of physical RAM and 4GB of swap. -- Bartek
--- bartosz.slowinski@gmail.com wrote:> I've got a simple (32bit) windows application (compiled in Borland c++ > builder): > > int *p; > while(1) { > p = new int[10000000]; //allocates 40 MB of memory > } > > on Windows XP it crashes after 50 iterations (i.e. 2 GB allocated) > > but on wine it crashes after 30 iterations (1200 MB allocated) > > is it impossible to use 2gb of memory in wine? why only 1.2GB is > available? > > I've got wine 0.9.13, linux 2.4 (2.6 doesn't make any difference), > 2.5GB of physical RAM and 4GB of swap. >As a windows programmer who designs medical imaging graphics workstations, this is a problem I have had do deal with under windows for close to 10 years... This is caused by the split between user space and kernel space which limits an application to 2GB kernel / 2GB user. The problem with this is once you factor in that every windows application needs to map dlls to its user application space and these dlls do not load in a manner that conserves application space (they actually load in a scattered manner in the high user space area) the largest array that you can allocate in 32 windows (without the 3GB switch) is about 1.2GB. Since windows 2000 advanced server there is a new switch in your boot.ini file that enables a 3GB / 1GB split so it will be possible to load dlls a little higher in memory thus giving you a larger available address space. Now how does this all apply to wine. I believe wine properly emulates windows design feature and I think there is also a way for it to emulate the 3GB feature as well but I do not know the details of this on wine. Sorry. John
> As a windows programmer who designs medical imaging graphics workstations, this is > a > problem I have had do deal with under windows for close to 10 years... This is > caused by the split between user space and kernel space which limits an > application > to 2GB kernel / 2GB user. The problem with this is once you factor in that every > windows application needs to map dlls to its user application space and these dlls > do not load in a manner that conserves application space (they actually load in a > scattered manner in the high user space area) the largest array that you can > allocate in 32 windows (without the 3GB switch) is about 1.2GB. Since windows 2000 > advanced server there is a new switch in your boot.ini file that enables a 3GB / > 1GB > split so it will be possible to load dlls a little higher in memory thus giving > you > a larger available address space. Now how does this all apply to wine. I believe > wine properly emulates windows design feature and I think there is also a way for > it to emulate the 3GB feature as well but I do not know the details of this on > wine. > Sorry. > > John >Oops, sorry I did not read your post clearly enough. Darn multitasking... John
Sorry for so many emails. However I believe my first answer is still in play as if you have only a 2GB address space there is no way you can allocate 50 x 40MB buffers because that would mean that no dlls were loaded for your application and I believe every single windows program must atleast use user.dll. John
On Wed, 14 Jun 2006 04:01:20 -0700, bartosz.slowinski wrote:> is it impossible to use 2gb of memory in wine? why only 1.2GB is > available?Probably VM fragmentation. Remember that Wine is loading more things behind the scenes, and at different locations, than Windows would. So there is less contiguous VM space available. If you change your benchmark to allocate, say, 1mb chunks using VirtualAlloc instead of HeapAlloc it might do better. thanks -mike
bartosz.slowinski@gmail.com wrote:> int *p; > while(1) { > p = new int[10000000]; //allocates 40 MB of memory > } > > on Windows XP it crashes after 50 iterations (i.e. 2 GB allocated) > > but on wine it crashes after 30 iterations (1200 MB allocated)'Crash' as in throws an exception? Daniel
> I've got a simple (32bit) windows application (compiled in Borland c++ > builder): > > int *p; > while(1) { > p = new int[10000000]; //allocates 40 MB of memory > }We did the same thing on our older wine (20050419) and found that we could up the amount to very close to 2GB by playing with WINEPRELOADRESERVE. - Michael Ost