Data-Flow (Escape) Analysis to Aid in Avoiding GC

Tobias Pankrath via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 13 05:05:57 PST 2015


On Friday, 13 February 2015 at 12:58:40 UTC, Per Nordlöw wrote:
> On Friday, 13 February 2015 at 12:50:14 UTC, Tobias Pankrath 
> wrote:
>> There are no reference counts involved, just simple arithmetic.
>>
>> string a = "abc";
>> string b = a[1 .. $];
>
> Then how does the GC know when to release when there are 
> multiple references?
>
> Is this because string references immutable storage?

It scans the memory for pointers to the memory to be freed before 
freeing them.

> Isn't vgc recursively inferred bottom-up for calls to templates 
> functions?

I didn't know vgc exists until your question, so I don't know 
what it does exactly. Thought that it will highlight calls to 
GC.malloc in the current function, even if emitted by the 
compiler for e.g. closures. I don't think it treats template 
functions different than other functions (it only considers their 
signature).



More information about the Digitalmars-d-learn mailing list