ma199at@sdcc6.ucsd.edu (L J Cris) (12/30/89)
What I would have liked for Christmas: A real list of routines that will or will not scramble/purge the heap. I don't want to seem unhappy with what was listed in the X-Ref manual of Inside Macintosh, but I am. Can someone explain to me why DisposHandle, DisposPtr or SndDisposeChannel and many other dispose routines would scramble/purge the heap? All they do is deallocate memory, don't they? Other than the memory you want to release, what else would be affected? -cris rys ma199at@sdcc6.ucsd.edu
trebor@biar.UUCP (Robert J Woodhead) (12/31/89)
ma199at@sdcc6.ucsd.edu (L J Cris) writes: >What I would have liked for Christmas: >A real list of routines that will or will not scramble/purge the heap. Assume EVERYTHING will change the heap. Assume that any time you go withing spitting distance of the ROM, the heap will scramble. Assume that EVERY procedure call will muddle it up. If you use dereferenced handles of any type, MoveHHi and HLock them without fail, for Woodhead's Law of Mis-Handling clearly states that: ``Even if a rom call doesn't mess with the heap at present, it's sure to do it in the future. Either Apple or a bright INIT writer will patch it in such a way as to screw you.'' -- Robert J Woodhead, Biar Games, Inc. !uunet!biar!trebor | trebor@biar.UUCP Announcing TEMPORAL EXPRESS. For only $999,999.95 (per page), your message will be carefully stored, then sent back in time as soon as technologically possible. TEMEX - when it absolutely, postively has to be there yesterday!
tim@hoptoad.uucp (Tim Maroney) (12/31/89)
In article <5847@sdcc6.ucsd.edu> ma199at@sdcc6.ucsd.edu (L J Cris) writes: >Can someone explain to me why DisposHandle, DisposPtr or >SndDisposeChannel and many other dispose routines would scramble/purge >the heap? > >All they do is deallocate memory, don't they? Other than the memory >you want to release, what else would be affected? That's probably correct, but what the list is really about is "routines you can't call at interrupt time". Because the heap data structures might be in mid-revision when an interrupt is invoked, it would be unsafe to call these rouines during an interrupt. Perhaps a better course would have been for Apple to distinguish between routines that may cause relocation and routines which can't be called at interrupt time, but since they merged the two lists (and the former is a subset of the latter) you can't count on handles remaining still even when routines like DisposPtr are called. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Next prefers its X and T capitalized. We'd prefer our name in lights in Vegas." -- Louis Trager, San Francisco Examiner