Reputation: 29
Image demonstrating the memory window while debugging When using the memory window in visual studio, do we see the virtual address of that process or the physical address of RAM?
Upvotes: 2
Views: 1055
Reputation: 8965
To clarify: all operating systems (except MS-DOS and the like ...) run user programs in a virtual memory space. Each program has its own perception of what "location $12345678
contains," and each program's perception is, for it, correct. Each program can have a different number there, and can change it at its own pleasure.
They can do this because none of them actually know:
$12345678
'" actually resides. (If it does ... and quite-possibly it doesn't!)$12345678
.The operating system maintains virtual memory for each process, using a combination of physical-RAM and (if necessary) page-file and/or swap-file space. Information that is actively being used by a process is made available to it "on demand," at a physical RAM-location that is both unknown to it and unknowable by it. Information that has not recently been used is eventually "stolen" from physical RAM and moved to external storage ... until it is referenced again, triggering what is known as a "page fault."
The memory view that is given to you by a debugger is the memory view that is perceived by and that is correct for the program being debugged: virtual addresses, in the process's virtual memory.
Upvotes: 0
Reputation: 8965
User-level code always sees virtual addresses. It has no way to know what physical address (if any!) presently corresponds to one of these addresses. "Virtual" is the only world that it lives in, and the only one that it ever knows. For all of a program's intents and purposes, "virtual is reality."
Upvotes: 2