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