Возможно, вы захотите отследить проблемы с производительностью до распределения памяти, прежде чем начинать оптимизацию для этого.
Итак, сузьте свой профиль, чтобы точно определить местонахождение проблемы. Это может быть много вызовов одного и того же кода, которые могут не занять много времени при вызове только один раз.
Windows Vista implements address space layout randomization, heap randomization, and stack randomization. This is a security mechanism, trying to prevent buffer overflow attacks that rely on the knowledge of where each piece of code and data is in memory.
It's possible to turn off ASLR by setting the MoveImages registry value. I couldn't find a way to disable heap randomization, but some Microsoft guy recommends computing addresses relative to _crtheap
. Even if the heap moves around, the relative address may remain stable.