Using closure causes GC allocation
    Vino.B via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Sat Sep  2 10:43:08 PDT 2017
    
    
  
Hi All,
    Request your help on how to solve the issue in the below code 
as when i execute the program with -vgc it state as below:
NewTD.d(21): vgc: using closure causes GC allocation
NewTD.d(25): vgc: array literal may cause GC allocation
void logClean (string[] Lglst, int LogAge) {   //Line 21
	if (!Lglst[0].exists) { mkdir(Lglst[0]); }
	auto ct1 = Clock.currTime();
	auto st1 = ct1 + days(-LogAge);
	auto dFiles = dirEntries(Lglst[0], SpanMode.shallow).filter!(a 
=> a.exists && a.isFile && a.timeCreated < st1).map!(a 
=>[a.name]).array;  // Line 25
	  dFiles.each!(f => f[0].remove);
}
From,
Vino.B
    
    
More information about the Digitalmars-d-learn
mailing list