home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12465 < prev    next >
Encoding:
Text File  |  1992-08-17  |  1.2 KB  |  26 lines

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