ADC Home > Reference Library > Technical Q&As > Legacy Documents > Mac OS 9 & Earlier >
Legacy Document
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:
Technical Q&A ME01
Preventing Memory Leaks
|
Q: When NewPtr is used to allocate a block of memory in the application heap, is
it necessary to use DisposePtr to release this block when the program
terminates?
A: No. All memory allocated by an application in the application heap (with
NewPtr , NewHandle , NewPtrClear , or NewHandleClear ) is
released by the Process
Manager when the application terminates, and the application's heap zone is
destroyed. This means that you do not explicitly have to call DisposePtr to
release blocks of memory you allocate with a NewPtr call before the
application exits.
If your application allocates memory in the system heap, then it must
deallocate it. Otherwise, leaks occur. Calls that allocate memory in the system
heap include NewHandleSys , NewHandleSysClear , NewPtrSys , and NewPtrSysClear .
[May 01 1995]
|
We’re sorry, an error has occurred.
Please try submitting your feedback later.
Thank you for providing feedback!
Your input helps improve our developer documentation.