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: More Macintosh Toolbox /
Chapter 1 - Resource Manager / Resource Manager Reference
Resource Manager Routines / Disposing of Resources


ReleaseResource

You can use the ReleaseResource procedure to release the memory a resource occupies when you have finished using it.

PROCEDURE ReleaseResource (theResource: Handle);
theResource
A handle to a resource.
DESCRIPTION
Given a handle to a resource, ReleaseResource releases the memory occupied by the resource data, if any, and sets the master pointer of the resource's handle in the resource map in memory to NIL. If your application previously obtained a handle to that resource, the handle is no longer valid. If your application subsequently calls the Resource Manager to get the released resource, the Resource Manager assigns a new handle.

If the given resource isn't a handle to a resource, ReleaseResource does nothing, and ResError returns the result code resNotFound. Be aware that ReleaseResource won't release a resource whose resChanged attribute has been set, but ResError still returns the result code noErr.

SPECIAL CONSIDERATIONS
The ReleaseResource procedure may move or purge memory blocks in the application heap. Your application should not call this procedure at interrupt time.

RESULT CODES
noErr0No error
resNotFound-192Resource not found
SEE ALSO
To check for errors, call the ResError function as described on page 1-47.

For more information about releasing resources, see "Releasing and Detaching Resources" beginning on page 1-17. For an example of the use of the ReleaseResource procedure, see Listing 1-8 on page 1-23.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996