Why doesn't Windows keep randomizing the base address of my executable?

Viewed 1317

I've made a simple C-program that simply prints the address of main() at execution:

printf("%08X\n", &main);

I compile it with Visual C++ 2015 with the parameter /DYNAMICBASE, for x86 (same thing happens when compiling for x64).

First two times I run it, the address returned is different, as is expected. However, after two times, the address the program returns stays the same:

00C31050
00221050
00221050
00221050 

Recompiling or renaming the executable randomizes the address again.

What is happening here? Is Windows somehow caching the executable?

1 Answers
Related