Re: Using closure causes GC allocation

2017-09-05 Thread Vino.B via Digitalmars-d-learn
On Monday, 4 September 2017 at 14:42:45 UTC, Azi Hassan wrote: On Monday, 4 September 2017 at 05:45:18 UTC, Vino.B wrote: In order to resolve the issue "Using closure causes GC allocation" it was stated that we need to use delegates Alternatively you can drop the functional sty

Re: Using closure causes GC allocation

2017-09-04 Thread Azi Hassan via Digitalmars-d-learn
On Monday, 4 September 2017 at 05:45:18 UTC, Vino.B wrote: In order to resolve the issue "Using closure causes GC allocation" it was stated that we need to use delegates Alternatively you can drop the functional style and use a foreach loop that doesn't require delegates, but y

Re: Using closure causes GC allocation

2017-09-04 Thread Nicholas Wilson via Digitalmars-d-learn
to resolve the issue "Using closure causes GC allocation" it was stated that we need to use delegates, can you please help me on how to as i have not gone that much far in D programming. import std.stdio: File,writeln; import std.datetime.systime: Clock, days, SysTime; import std.file

Re: Using closure causes GC allocation

2017-09-03 Thread Vino.B via Digitalmars-d-learn
, string)[]` instead of `string[][]`), or let the compiler infer it via auto (`auto cleanFiles(...`). Hi, Thank you very much, was able to resolve the second code issue by changing the return type of the function. Hi, In order to resolve the issue "Using closure causes GC alloc

Re: Using closure causes GC allocation

2017-09-02 Thread Vino.B via Digitalmars-d-learn
On Saturday, 2 September 2017 at 20:10:58 UTC, Moritz Maxeiner wrote: On Saturday, 2 September 2017 at 18:59:30 UTC, Vino.B wrote: [...] Cannot reproduce under Linux with dmd 2.076.0 (with commented out Windows-only check). I'll try to see what happens on Windows once I have a VM setup.

Re: Using closure causes GC allocation

2017-09-02 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 2 September 2017 at 18:59:30 UTC, Vino.B wrote: On Saturday, 2 September 2017 at 18:32:55 UTC, Moritz Maxeiner wrote: On Saturday, 2 September 2017 at 18:08:19 UTC, vino.b wrote: On Saturday, 2 September 2017 at 18:02:06 UTC, Moritz Maxeiner wrote: On Saturday, 2 September 2017

Re: Using closure causes GC allocation

2017-09-02 Thread Vino.B via Digitalmars-d-learn
On Saturday, 2 September 2017 at 18:32:55 UTC, Moritz Maxeiner wrote: On Saturday, 2 September 2017 at 18:08:19 UTC, vino.b wrote: On Saturday, 2 September 2017 at 18:02:06 UTC, Moritz Maxeiner wrote: On Saturday, 2 September 2017 at 17:43:08 UTC, Vino.B wrote: [...] Line 25 happens because

Re: Using closure causes GC allocation

2017-09-02 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 2 September 2017 at 18:08:19 UTC, vino.b wrote: On Saturday, 2 September 2017 at 18:02:06 UTC, Moritz Maxeiner wrote: On Saturday, 2 September 2017 at 17:43:08 UTC, Vino.B wrote: [...] Line 25 happens because of `[a.name]`. You request a new array: the memory for this has to be

Re: Using closure causes GC allocation

2017-09-02 Thread vino.b via Digitalmars-d-learn
On Saturday, 2 September 2017 at 18:02:06 UTC, Moritz Maxeiner wrote: On Saturday, 2 September 2017 at 17:43:08 UTC, Vino.B wrote: [...] Line 25 happens because of `[a.name]`. You request a new array: the memory for this has to be allocated (the reason why the compiler says "may" is because

Re: Using closure causes GC allocation

2017-09-02 Thread Moritz Maxeiner via Digitalmars-d-learn
On Saturday, 2 September 2017 at 17:43:08 UTC, Vino.B wrote: 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

Using closure causes GC allocation

2017-09-02 Thread Vino.B via Digitalmars-d-learn
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