How is it possible for an application to have static memory addresses?

680 views Asked by At

I'm using a memory editing application known as Cheat Engine. I attach Cheat Engine to a game. In my game, I have a 32-bit integer known as HP. HP is stored at a memory address A. If I restart my game, HP is stored at a new memory address B. It seems that using Cheat Engine, I can do a pointer scan and find a static memory address, C, that always stores HP's memory address during that session. So if I dereference C, I always get the memory address that stores HP. How is it always guaranteed for C to always be the same memory address? What if another application starts and occupies that region of memory?

1

There are 1 answers

3
Mark Bertenshaw On BEST ANSWER

I don't know what OS you are using, but most modern OSs use virtual memory for each process. The memory address for each program could be identical. The OS and computer map the virtual address to a real address in RAM.