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

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 13 04:40:56 PST 2015


On Friday, 13 February 2015 at 11:52:50 UTC, Tobias Pankrath 
wrote:
> On Friday, 13 February 2015 at 11:34:50 UTC, Per Nordlöw wrote:
>> On Friday, 13 February 2015 at 09:13:48 UTC, Kagamin wrote:
>>> Whether s.front uses GC is determined by s.front 
>>> implementation, caller can't affect it.
>>
>> Compiling
>>
>> https://github.com/nordlow/justd/blob/master/t_splitter.d
>>
>> with -vgc on dmd git master gives no warnings about GC 
>> allocations!
>>
>> Is this really true!?
>
> Why should splitter.front allocate?

Ahh, I think I understand now. I thought that slice creations 
ment GC-allocation but it doesn't right? It just increases a 
reference counter somewhere and creates a stack context for the 
slice right?

But what about to!string in

     auto x = line.strip.splitter!isWhite.joiner("_").to!string;

?


More information about the Digitalmars-d-learn mailing list