home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!portal!cup.portal.com!Chewy
- From: Chewy@cup.portal.com (Paul Frederick Snively)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: Loading Resources into MF Temp Mem.
- Message-ID: <62641@cup.portal.com>
- Date: Wed, 22 Jul 92 22:13:40 PDT
- Organization: The Portal System (TM)
- References: <1992Jul14.200403.9031@athena.mit.edu>
- Lines: 19
-
- I have an alternative, hopefully simpler, suggestion:
-
- Use Gestalt to determine whether temporary memory is `real memory' or not.
- If it is, then allocate a small (say, zero byte) temporary handle, and call
- HandleZone on it to get the temorary zone. Then you can GetZone the current
- Zone, SetZone to the temporary zone, manage memory, and when you're done,
- SetZone back to the old Zone.
-
- Incidentally, when using temporary memory, it's best to _avoid_ MoveHHi,
- because MultiFinder/The Process Manager allocate application space _from the
- top down_, so MoveHHi on temporary handles will actually tend to _cause_ heap
- fragmentation rather than alleviate it. Instead, you may wish to consider
- using ReservMem to attempt to reserve memory, and then allocate your temporary
- handle. ReservMem attempts to reserve memory as _low_ in the heap as possible
- (it's what NewPtr calls to do its thing).
-
- Paul Snively
- Dissolute Wandering Hacker
- chewy@apple.com
-