How the GC distinguishes code from data
pelle.mansson at gmail.com
Fri Jan 7 10:39:35 PST 2011
On 01/07/2011 06:47 PM, %u wrote:
>> It assumes everything on the stack is pointers, at the moment, I believe
> Uh-oh... not the answer I wanted to hear, but I was half-expecting this.
> So doesn't that mean that, at the moment, D will leak memory?
Kinda sorta. I haven't had any problems from that. If you allocate very
large blocks in the garbage collector you may face trouble :-)
>> If it's not on the garbage collected heap, it won't scan it unless you
>> tell it to.
> But what if it's a void on a non-GC heap? Doesn't the language say that needs to
> be scanned too?
You have to add it to the garbage collector's list of roots, I'm not
sure what it's named exactly. Note that you only have to do that if
there actually are pointers to the gc heap there.
More information about the Digitalmars-d-learn