home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / mac / programm / 20420 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.9 KB  |  42 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!spool.mu.edu!umn.edu!csus.edu!netcom.com!upstill
  3. From: upstill@netcom.com (Steve Upstill)
  4. Subject: Resource Manager Purging Wierdness
  5. Message-ID: <1992Dec30.070004.6847@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. Distribution: usa
  8. Date: Wed, 30 Dec 1992 07:00:04 GMT
  9. Lines: 31
  10.  
  11. I know this is the brave new world of unlimited RAM, but here I am 
  12. struggling to live in the world of Mac Plus'es and SE's, so I make 
  13. everything in the world purgeable, including a variety of resources.
  14. I dutifully call SetResPurge(TRUE) so that any changed resources 
  15. (yes, I change them too) get written to disk. But still, under 
  16. low-memory conditions my resources start disappearing on me 
  17. (i.e., they're read in at size 0), implying that they were written 
  18. to disk empty anyway. 
  19.  
  20. Now, there are ominous hints here and there that if the resource map is 
  21. written to disk and a resource has been purged, then an empty resource 
  22. will be written because, regardless of whether the resource was written 
  23. out at purge-time, it's still empty in memory and so the map is incorrect.
  24. Unfortunately, this is as deep as the discussion gets (??!?), leaving 
  25. only a tantalizing hint to the effect that "yes, we may destroy your data, 
  26. but we're not going to say for sure, or indicate exactly when it might happen."
  27.  
  28. So it looks like data gets trashed under the following scenario:
  29.  
  30. 1) a purgeable resource gets purged.
  31. 2) another resource is marked as changed
  32. 3) UpdateResFile() is called (perhaps by CloseResFile()). Because the map 
  33. has changed, the file gets written. Because the resource from 1) was 
  34. purged, its handle is empty and thus gets written empty.
  35.  
  36. I can't believe that this can happen this way, yet I am at a loss to 
  37. otherwise explain the 0-length resources that keep cropping up. Any clues?
  38.  
  39. Thanks,
  40. Steve Upstill
  41.  
  42.