Related articles |
---|
[15 earlier articles] |
Re: Best Ref-counting algorithms? cr88192@hotmail.com (BGB / cr88192) (2009-07-15) |
Re: Best Ref-counting algorithms? cr88192@hotmail.com (BGB / cr88192) (2009-07-15) |
Re: Best Ref-counting algorithms? gene.ressler@gmail.com (Gene) (2009-07-15) |
Re: Best Ref-counting algorithms? torbenm@pc-003.diku.dk (2009-07-16) |
Re: Best Ref-counting algorithms? bartc@freeuk.com (BartC) (2009-07-16) |
Re: Best Ref-counting algorithms? gneuner2@comcast.net (George Neuner) (2009-07-16) |
Re: Best Ref-counting algorithms? haberg_20080406@math.su.se (Hans Aberg) (2009-07-17) |
Re: Best Ref-counting algorithms? haberg_20080406@math.su.se (Hans Aberg) (2009-07-17) |
Re: Best Ref-counting algorithms? cppljevans@gmail.com (Larry) (2009-07-17) |
Re: Best Ref-counting algorithms? lerno@dragonascendant.com (=?ISO-8859-1?Q?Christoffer_Lern=F6?=) (2009-07-17) |
Re: Best Ref-counting algorithms? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2009-07-17) |
Re: Best Ref-counting algorithms? gneuner2@comcast.net (George Neuner) (2009-07-17) |
Re: Best Ref-counting algorithms? gneuner2@comcast.net (George Neuner) (2009-07-17) |
[12 later articles] |
From: | Hans Aberg <haberg_20080406@math.su.se> |
Newsgroups: | comp.compilers |
Date: | Fri, 17 Jul 2009 13:05:31 +0200 |
Organization: | Aioe.org NNTP Server |
References: | 09-07-018 09-07-023 09-07-027 09-07-037 09-07-042 |
Keywords: | GC |
Posted-Date: | 17 Jul 2009 14:44:33 EDT |
Christoffer LernC6 wrote:
>> But what language are you planning use for the implementation? If you
>> choose C++, then it is hard to find the root set. Suppose you create
>> object for use in your language; then global objects and those in th
>> stack should be registered somehow for the tracing, but those on the
>> heap should not, as the are live when they can be traced from the other.
>
> I was thinking of using C for implementation, but does that matter? As
> long as I implement the language in a non GC:ed language I will have
> to take care of writing the GC myself (or for C, use the Bohm
> conservative GC).
If you want to make a tracing GC in C++, then you will have to keep
track of where elements are located by hand.
For example, if you have class Object which keep track of a polymorphic
pointer, and a
class S {
Object x, y;
...
};
Then in
T f(...) {
Object w = new S(...);
...
}
the w belongs to the root set, as it is allocation on the function
stack, whereas the S::x, S::y are on the heap, as they are allocated via
the "new S".
So at least for dynamic languages, this is problem.
Hans
Return to the
comp.compilers page.
Search the
comp.compilers archives again.