ogden@nmsu.edu (Bill Ogden) (03/13/91)
Can some kind soul give me some help and tell me how to manage large resouce files? I have large PICT resources (aprox. 10k) and large 'snd ' resources (aprox. 7k) and would like to be able to show or play 60 of them (at least twice). What sequence of GetResource(), LoadResource(), ReleaseResource(), DisposHandle(), or CompactMem(), should I use to keep the heap from fragmenting and from running out of memory. I know this is too easy for many of you but I'd appreciate the help. Thanks. BTW, I'm using Think C 3.01. on a Mac IIcx w/ 2 meg. -- ogden@nmsu.edu Bill Ogden Computing Research Lab New Mexico State University Las Cruces, NM
peirce@outpost.UUCP (Michael Peirce) (03/14/91)
In article <OGDEN.91Mar12225043@aigyptos.nmsu.edu>, ogden@nmsu.edu (Bill Ogden) writes: > > Can some kind soul give me some help and tell me how to manage > large resouce files? I have large PICT resources (aprox. 10k) > and large 'snd ' resources (aprox. 7k) and would like to be able > to show or play 60 of them (at least twice). What sequence of > GetResource(), LoadResource(), ReleaseResource(), DisposHandle(), > or CompactMem(), should I use to keep the heap from fragmenting and > from running out of memory. I know this is too easy for many of > you but I'd appreciate the help. Thanks. BTW, I'm using Think C > 3.01. on a Mac IIcx w/ 2 meg. The simplest strategy is to make sure that all your resources are marked purgeable and don't lock them unless you are using them. Simply load in the one you need, lock the resource only for the duration you need (for example, lock it right before your call to DrawPicture(), then unlock it) and don't sweat it. As more resources are read in and memory gets low, the unused ones will get purged. If you need them again, call GetResource() again. -- michael -- Michael Peirce -- outpost!peirce@claris.com -- Peirce Software -- Suite 301, 719 Hibiscus Place -- Macintosh Programming -- San Jose, California 95117 -- & Consulting -- (408) 244-6554, AppleLink: PEIRCE