home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.programming
- Path: sparky!uunet!wupost!darwin.sura.net!jvnc.net!yale.edu!ira.uka.de!math.fu-berlin.de!zrz.tu-berlin.de!mailgzrz.tu-berlin.de!nickel
- From: nickel@cs.tu-berlin.de (Juergen Nickelsen)
- Subject: cleanup on exit (Was Re: Chasing memory leaks: tools, procedures?)
- In-Reply-To: fjh@munta.cs.mu.OZ.AU's message of Tue, 21 Jul 1992 14:27:02 GMT
- Message-ID: <NICKEL.92Jul22200234@desaster.cs.tu-berlin.de>
- Sender: news@mailgzrz.tu-berlin.de (News Manager)
- Nntp-Posting-Host: desaster.cs.tu-berlin.de
- Reply-To: nickel@cs.tu-berlin.de
- Organization: STONE Project, Technical University of Berlin, Germany
- References: <1992Jul6.093355.20442@lth.se>
- <1992Jul18.203518.14496@murdoch.acc.Virginia.EDU>
- <1992Jul19.160323.8820@organpipe.uug.arizona.edu>
- <NICKEL.92Jul19184631@desaster.cs.tu-berlin.de>
- <9220400.530@mulga.cs.mu.OZ.AU>
- Date: Wed, 22 Jul 1992 19:02:34 GMT
- Lines: 35
-
- In article <9220400.530@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU
- (Fergus James HENDERSON) writes:
-
- > nickel@cs.tu-berlin.de (Juergen Nickelsen) writes:
- [...]
- > >To make this more useful, must_alloc() should also call some
- > >cleanup-function. For some application it is a must to have control of
- > >their termination, e.g. to remove temporary files, re-rename
- > >temporarily renamed files etc.
- >
- > Why not just use at_exit() to install an error handler if necessary?
-
- I would really *like* to use it, but it's not portable. SunOS has a
- function
-
- int on_exit(procp, arg)
-
- , but the manual page says
-
- NOTES
- This call is specific to the SunOS operating system and
- should not be used if portability is a concern.
-
- POSIX doesn't define something like this, SysV.3, BSD 4.3, and Ultrix
- don't seem to have somthing like that.
-
- "Historical" Note:
- With VAX C on VMS, at_exit() (or atexit() ?) was fun, since the
- installed exit handler was executed even when the program had been
- interrupted and the user started another one. (The program image was
- still considered running then, if it hadn't been explicitely removed
- with "stop".) Caused lots of user confusion.
-
- --
- Juergen Nickelsen
-