on windows 7 64bit, how much address space can a 32bit program access?
when using the LARGEADDRESSAWARE flag, can my 32bit program access 4GB of address space, or only 3G开发者_如何学PythonB of address space? why?
A 32 bit process with LARGEADDRESSAWARE set can address 4GB on 64 bit Windows. It can do so because that's how the wonderful engineers at Microsoft implemented it.
It's documented here.
maybe the anwser is there
A 32 bit process will access 2GB RAM, with the LARGEADDRESSAWARE flag, it reaches the 4GB
http://blogs.msdn.com/b/hiltonl/archive/2007/04/13/the-3gb-not-4gb-ram-problem.aspx
http://www.oldunreal.com/cgi-bin/yabb2/YaBB.pl?num=1200330824
In most OSes your 32-bit space is broken up into parts that you're program(user-code) can allocate and use, and sections that the kernel owns. Unless you're writing your own OS/kernel let the system APIs(such as malloc/free, new/delete in C/C++) or the the underlying management in python, java manage the memory allocation for you.
However, if you're getting 'out of memory' errors start to consider
- Do I have a leak somewhere? You're not free'ing every pointer you're malloc'ing Wonderous tools such as valgrind can help find those.
- Do I need to redesign my program to use less memory? Are you doing things like saving every line of data you read out of a huge file in an array in python or java. Look for stuff you can throw away
精彩评论