home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!microsoft!hexnut!jimad
- From: jimad@microsoft.com (Jim Adcock)
- Subject: Re: Garbage Collection for C++
- Message-ID: <1992Aug17.235127.14563@microsoft.com>
- Date: 17 Aug 92 23:51:27 GMT
- Organization: Microsoft Corporation
- References: <1992Aug6.014619.2111@ucc.su.OZ.AU> <3907@starlab.UUCP> <1992Aug13.151749.15679@ucc.su.OZ.AU>
- Lines: 15
-
- In article <1992Aug13.151749.15679@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
- | GC pointers are like *ordinary* C++ classes, not GC classes.
- |If GC objects were allowed on the stack, they would have to be
- |copied when the lexical scope was exited if there were still
- |existant pointers to them. So why not just allocated them
- |on the GC heap in the first place?
-
- For the same reason that in today's C++ why all objects are not allocated
- on the heap. Namely because the vast majority of objects do not survive
- the lifetime of the scope of where they are created. Therefore, a
- strategy where all objects are created first on the stack, and then
- evacuated if and only if they survive the scope, would be faster than creating
- everything on the heap. An interesting variation on this idea would be
- to change our computers from being stack-based to being fifo-based.
-
-