home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!gatech!darwin.sura.net!convex!news.utdallas.edu!corpgate!crchh327!bnr.ca!holiday
- From: holiday@bnr.ca (Matthew Holiday)
- Subject: Re: Garbage Collection for C++
- Message-ID: <1992Aug31.152016.25173@bnr.ca>
- Sender: holiday@crchh82 (Matthew Holiday)
- Nntp-Posting-Host: crchh82
- Reply-To: holiday@bnr.ca
- Organization: Bell-Northern Research, Richardson, TX
- References: <DAVEG.92Aug20043156@synaptx.synaptics.com> <28623@vedge.UUCP> <DAVEG.92Aug28004331@synaptx.synaptics.com> <23580@alice.att.com>
- Date: Mon, 31 Aug 1992 15:20:16 GMT
- Lines: 29
-
- In article <23580@alice.att.com>, ark@alice.att.com (Andrew Koenig) writes:
- |>
- |> I think the right answer, at least for most practical purposes, is to
- |> say that the purpose of garbage collection is to simulate unbounded
- |> memory. Once an object has become garbage, there is no way to tell
- |> whether that memory is still in use, so the implementation should be
- |> allowed to reclaim it without explicitly destroying the object.
- |> As a programmer, you shouldn't care; you have no way of finding out that
- |> it happened.
- |>
-
- One of the things that makes GC attractive is the need to reclaim memory that
- might be leaked during exception handling. Imagine that a function allocates
- an array with new [], and then an exception transfers control to a scope which
- isn't prepared to delete that array. Unless there is strong coupling between
- exception handlers and try blocks (i.e., every potential handler for a exception
- knows about the places the exception may originate, and the need for store
- reclamation), there will be memory leaks resulting from exceptions. One way
- to deal with this is for every try block to have a catch block for every
- exception type, in which all cleanup takes place, and then re-throws the
- exception to a handler which can actually act on the exception type. Its not
- particularly elegant, but perhaps would work.
-
- Any ideas?
-
- --
- Matt Holiday #include <std/disclaimer>
- holiday@bnr.ca
- BNR Richardson, TX
-