ADC Home > Reference Library > Technical Q&As > Legacy Documents > Hardware & Drivers >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

Virtual Memory Management

Q: When I unlock memory with UnlockMemory, does it affect only the memory I locked with LockMemory, or does it affect the whole page (i.e., will UnlockMemory unlock other memory in the same page)?

A: It affects the whole page, not just a smaller part of it. The Virtual Memory lock and hold functions not only lock or hold a page (or pages) of memory, they also increment an internal counter associated with those VM pages. The counter for a page of memory has to return to its initial value (i.e., the value the counter was when the page was in the unlocked/unheld state) before a page is finally unlocked or unheld. So, even if you allocate a little piece of memory and lock it, and the rest of your page is locked by another program, the other program's LockMemory and UnlockMemory calls won't affect your locks.
Inside Macintosh:Memory Chapter 1, Introduction to Memory Management, page 20, Locking and Unlocking Relocatable Blocks.

[May 01 1995]


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.