I use this windows API, http://msdn.microsoft.com/en-us/library/aa366589(v=vs.85).aspx GlobalMe开发者_如何学JAVAmoryStatusEx to get memory information my computer total physcial memory is 4096MB ,why the program shows 3.XG My computer's virtual memory is 3063MB ,but i use program which show 2047MB my develop enviroment is visual studio 2008 how to modify this problem
thanks
Aren't other programs using your system as well? I suspect the memory you're "missing" is due to the OS itself and whatever other programs you're running. See if having a bunch of other applications open changes the virtual memory size that your program is able to see.
Assuming you are running a 32bit version of windows, then this is a limit of windows itself. See this Microsoft page for the details. By default you will only be able to access 2GB of RAM in a single process. There is a compiler switch in visual studio which will give you access to 3GB. This is the /LARGEADDRESSAWARE switch. Beyond that you just need to upgrade to a 64bit operating system.
By the way, the basic reason why you don't automatically get 4GB of address space is because part of it is reserved for the operating system. Those system calls and references to operating system resources have to live somewhere.
精彩评论