MEMORY
Steal temporary memory
Just a small point:
Do not confuse "temporary memory" with "system heap memory." They are two different things, in two different locations. To get a block of system heap memory, you use a statement like this:
h& = FN NEWHANDLE _sys (size&)
But to get a block of temporary memory, you need to call the Toolbox function TempNewHandle, like this:
h& = FN TempNewHandle&(size&, @OSErr%)
where FN TempNewHandle& is defined like this:
'--------------------------------------------------------
LOCAL FN TempNewHandle&(size&, OSErrAddr&)
` CLR.L -(SP)
` MOVE.L ^size&,-(SP)
` MOVE.L ^OSErrAddr&,-(SP)
` MOVE.W #$001D,-(SP)
` DC.W $A88F
` MOVE.L (SP)+,^handle&
END FN = handle&
'--------------------------------------------------------
The available Temporary Memory is often (but not always) larger than the available System Heap space, so you will probably have a better chance of getting a block if you get it from Temporary Memory.
|