Can't allocate more than around 1.5 GB of memory, even though I have 8 GB

Started by cork, August 07, 2010, 07:30:46 PM

Previous topic - Next topic

cork

I'm running Vista 64-bit.

I'm using MASM32 to create a 32-bit exe. When I allocate 1 GB from a growable heap it works fine. Allocating 1.5 GB works fine. Allocating 2 GB fails miserably.

I'm presuming it has something to do with this being a 32-bit EXE and that limits me to 2 GB of address space or something?

UPDATE: I've been reading a little bit about WOW64 and ran across this quote: "If the application has the IMAGE_FILE_LARGE_ADDRESS_AWARE flag set in the image header, each 32-bit application receives 4 GB of virtual address space in the WOW64 environment. If the IMAGE_FILE_LARGE_ADDRESS_AWARE flag is not set, each 32-bit application receives 2 GB of virtual address space in the WOW64 environment."

UPDATE: I found this page, about "4GT RAM Tuning", which pretty much sums it up.
http://msdn.microsoft.com/en-us/library/aa366521%28v=VS.85%29.aspx



Farabi

I havent try 64-bit machine, but I guess thoeorytically it should be able to access 4 GB of RAM.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

sinsi

Light travels faster than sound, that's why some people seem bright until you hear them.

hutch--

For the amount of messing around and the problems that follow from doing it, stick to 2 gig as long as the machine has more and you are reasonably safe. The alternative is to set up the machine at boot to be large address aware and use a trick linker option to get a bit more but it comes at the cost of having less high address space for the OS and other hardware like video and this can catch up with you at times.

On a 64 bit box you have the same limit in 32 bit applications but you can start more of them that use the 32 bit theoretical maximum of 2 gig so if you have some need, use some form of IPC and you can have more memory available than a 32 bit app would normally have. I have tested this on Win7 64 bit.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

cork

Quote from: hutch-- on August 08, 2010, 09:00:39 AM
On a 64 bit box you have the same limit in 32 bit applications but you can start more of them that use the 32 bit theoretical maximum of 2 gig so if you have some need, use some form of IPC and you can have more memory available than a 32 bit app would normally have. I have tested this on Win7 64 bit.

Thanks Hutch. Since I'm writing the program for just myself, maybe I'd be better of just trying to write it as a native 64-bit application using MASM. I need to use 64-bit math, also, so that would kill 2 birds with one stone.

redskull

You can also use AWE to access more than the 2GB, at the expense of having to utilize a swapping type mechanism.  Also, i could not say for sure how a 32-bit program would work under a 64-bit OS using awe, if at all.

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government