home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / mac / programm / 22273 < prev    next >
Encoding:
Text File  |  1993-01-27  |  1.6 KB  |  35 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!pageworks.com!world!eff!sol.ctr.columbia.edu!usc!elroy.jpl.nasa.gov!ames!agate!iat.holonet.net!bwilliam
  3. From: bwilliam@iat.holonet.net (Bill Williams)
  4. Subject: Re: Verifying valid handles, how to?
  5. Message-ID: <C1Hyzu.Buo@iat.holonet.net>
  6. Organization: HoloNet National Internet Access BBS: 510-704-1058/modem
  7. References: <mxmora-260193141225@css-mac1.sri.com>
  8. Date: Wed, 27 Jan 1993 05:23:53 GMT
  9. Lines: 24
  10.  
  11.  
  12. John brings up a very very important point. use other mechanisms for
  13. handle management to avoid memory leaks and handle double deletions.
  14.  
  15. I myself use a magic 16bit "boolean" in conjuction with each and every
  16. handle I allocate (I hardly ever use pointers) and use the magic value in
  17. a tattle tale routine upon deletion and program termination (sometimes) to
  18. tell me what problems I've introduced.
  19.  
  20. I also never purge unless need to and purge the right amount, and never
  21. compact unless need to and try to compact the right amount, and never do
  22. either if there is enough room for the desired handle plus the current
  23. reserved size of a contiguous imaginary area of the heap (usually about 32K)
  24.  
  25. by putting all these routines together in one set of utilities, you can
  26. then include the "memory_Initialized" flag in the same rountine to check
  27. for double creations as well as deletions..... of course none of this
  28. stuff is new to people who have to occasionally write massive applications.
  29.  
  30. With object-oriented mentalities, perhaps people may even start defining
  31. "handle" classes... Nah.... that may be going to extremes.
  32.  
  33. -- Bill Williams
  34.  
  35.