7Memory

Virtual Memory

Virtual memory is a way for the computer to fake having more memory than it actually has. A machine might have four gigabytes of RAM, but you can write programs that manipulate data several times that amount. When you overflow the available amount of real memory, portions of the data are saved out to disk and read back in when the program needs it.

The operating system handles the grungy details of keeping data that is currently being worked on physically in memory and moving data that has not been touched in a while out to the disk. It also pulls the data back into memory from disk if the program wants to work with it again.

The operating system divides memory into pages, 4KB chunks of memory that the operating system ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.