Important: The information in this document is obsolete and should not be used for new development.
SetResPurge
You can use theSetResPurge
procedure to have the Memory Manager pass the handle of a resource to the Resource Manager before purging the data specified by that handle.
PROCEDURE SetResPurge (install: Boolean);
install
- A Boolean value that specifies whether the Memory Manager checks with the Resource Manager before purging a resource handle.
DESCRIPTION
SpecifyTRUE
in theinstall
parameter to make the Memory Manager pass the handle for a resource to the Resource Manager before purging the resource data to which the handle points. The Resource Manager determines whether the handle points to a resource in the application heap. It also checks if the resource'sresChanged
attribute is set to 1. If these two conditions are met, the Resource Manager calls theWriteResource
procedure to write the resource's resource data to the resource fork before returning control to the Memory Manager.Specify
FALSE
in theinstall
parameter to restore the normal state, so that the Memory Manager purges resource data when it needs to without calling the Resource Manager.You can use
SetResPurge
in applications that modify purgeable resources. You should also take precautions in such applications to ensure that the resource won't be purged while you're changing it.SPECIAL CONSIDERATIONS
If you callSetResPurge
with theinstall
parameter set toTRUE
and then call the Memory Manager procedureMoveHHi
to move a handle to a resource, the Resource Manager calls theWriteResource
procedure to write the resource data to disk even if the data has not been changed. To prevent this, callSetResPurge
with theinstall
parameter set toFALSE
before you callMoveHHi
, then callSetResPurge
with theinstall
parameter set toTRUE
immediately after you callMoveHHi
.Whenever you call
SetResPurge
with theinstall
parameter set toTRUE
, the Resource Manager installs its own purge-warning procedure, overriding any purge-warrning procedure you've specified to the Memory Manager.SEE ALSO
To check for errors, call theResError
function as described on page 1-47.For descriptions of the
SetResAttrs
andWriteResource
procedures, see page 1-80 and page 1-88, respectively.For more information about the Memory Manager procedure
MoveHHi
, see Inside Macintosh: Memory.