Colleagues convert a 32 bit C++ application to 64 Bit. For testing purposes, the idea is now to instruct the heap manager to return addresses in the 64 bit range only.
Searching the Internet for solutions does not seem to give very reliable results:
MSDN forums suggest to use
VirtualAlloc()
before the CRT initializes. However, I can't see why that should not return a pointer to a high address already, leaving the bottom 4 GB empty.Raymond Chen says, Windows 7 has a switch called
AllocationPreference
which can be set toMEM_TOP_DOWN
. However, that applies to the whole system and thus requires a reboot, which is inconvenient. (also described on MSDN).
I dug around in application verifier and found some interesting options in the properties of the Heaps entry:
As you can see I have modified SizeStart and SizeEnd as well as AddrStart and AddrEnd.
Unfortunately,
- these text boxes do not accept 64 bit addresses
- these settings do not seem to have an effect
While the addresses are above the entered values, the size of the heaps has not changed:
Termination on corruption : ENABLED
Heap Flags Reserv Commit Virt Free List UCR Virt Lock Fast
(k) (k) (k) (k) length blocks cont. heap
-------------------------------------------------------------------------------------
000001e0aa590000 00000002 2040 1528 2040 3 1 2 0 0
000001e0aa440000 00001002 1080 248 1080 2 2 2 0 0
000001e0aa410000 00008000 64 4 64 2 1 1 0 0
000001e0aa520000 00001002 1080 104 1080 1 2 2 0 0
000001e0af2f0000 00001002 60 60 60 6 1 1 0 0
-------------------------------------------------------------------------------------
Do these application verifier settings still work? How to apply them successfully?