From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f6ee8ca03c176d76 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-08-31 13:39:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.stealth.net!news.stealth.net!news-east.rr.com!cyclone1.gnilink.net!news-out.nuthinbutnews.com!propagator2-sterling!news-in-sterling.newsfeed.com!news-in.nuthinbutnews.com!feed.cgocable.net!read1.cgocable.net.POSTED!53ab2750!not-for-mail Message-ID: <3D71297E.2080908@cogeco.ca> From: "Warren W. Gay VE3WWG" User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0rc2) Gecko/20020618 Netscape/7.0b1 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: stupid question: how can I finish a program? References: <5ee5b646.0208241822.34540e8b@posting.google.com> <3D6D00B9.60EECCFB@san.rr.com> <3D6D4F44.4872BCFA@san.rr.com> <3D6E507E.7010805@cogeco.ca> <7vadn4bwe3.fsf@vlinux.voxelvision.no> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 31 Aug 2002 16:39:26 -0400 NNTP-Posting-Host: 24.150.168.167 X-Complaints-To: abuse@cogeco.ca X-Trace: read1.cgocable.net 1030826558 24.150.168.167 (Sat, 31 Aug 2002 16:42:38 EDT) NNTP-Posting-Date: Sat, 31 Aug 2002 16:42:38 EDT Organization: Cogeco Cable Xref: archiver1.google.com comp.lang.ada:28634 Date: 2002-08-31T16:39:26-04:00 List-Id: Ole-Hjalmar Kristensen wrote: > "Warren W. Gay VE3WWG" writes: >>Robert A Duff wrote: >>>Darren New writes: >>>>Robert A Duff wrote: >>>>>Darren New writes: >>>>>>Robert A Duff wrote: ... >>Even in "proper O/S" there are occaisions where cleanup is needed, >>but not automatically done by the O/S. Here are 3 examples of >>this, that can happen on [pick your] UNIX: >> >> - Allocated _SHARED_ memory >> - Created message queues (IPC) >> - Create semaphores >> >>The reason these are not automatically cleaned up by the O/S is that >>sometimes you want them to persist beyond the creating process' >>lifetime (because they are shared by other processes). > > Certainly, it can cause a leak, but the leak does not get bigger when > you run the program again, because as you point out, you can aquire > the same resource again, and it's pretty trivial to check for the > existence of those *named* objects on startup. This is only true, if the application has arranged to make the resource globally identifiable, or has saved the IPC ID. A group of cooperating processes often only creates the necessary IPC resources and only knows them by IPC ID (for example, the resources are created, and a few subsequent fork(2) calls are made to share the resource known by IPC ID). After an abort, the IPC IDs are no longer known to the application -- and will create a new resource set instead. So this really depends upon the application design. THIS IS NOT A "GIVEN". > Contrast this with an > OS which leaks memory, does not close file handles, etc. On the next > run of the program, you will probably aquire a *new* chunk of memory > or another file handle, and so the garbage will build up over time. The very same can and often does happen with IPC resources. Not every application expects to re-use those resources after a process abort. -- Warren W. Gay VE3WWG http://home.cogeco.ca/~ve3wwg