Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Memory /
Chapter 2 - Memory Manager / Memory Manager Reference
Memory Manager Routines / Manipulating Heap Zones


TopMem

To find out the location of the top of an application's partition, you can use the TopMem function, which exhibits special behavior during the startup process.

FUNCTION TopMem: Ptr;
DESCRIPTION
Except during the startup process, the TopMem function returns a pointer to the byte at the top of an application's partition, directly above the jump table. The function does this to maintain compatibility with programs that check TopMem to find out how much memory is installed in a computer. To obtain this information, you can currently use the Gestalt function.

The function exhibits special behavior at startup time, and the value it returns controls the amount by which an extension can lower the value of the global variable BufPtr at startup time. If you are writing a system extension, you should not lower the value of BufPtr by more than MemTop DIV 2 + 1024. If you do lower BufPtr too far, the startup process generates an out-of-memory system error.

You should never need to call TopMem except during the startup process.

ASSEMBLY-LANGUAGE INFORMATION
The TopMem function returns the value of the MemTop global variable.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996