Re: How to allocate/free memory under @nogc

2020-05-22 Thread welkam via Digitalmars-d-learn
There is automem to help with manual memory management https://code.dlang.org/packages/automem

Re: How to allocate/free memory under @nogc

2020-05-22 Thread Kagamin via Digitalmars-d-learn
On Thursday, 21 May 2020 at 17:19:10 UTC, Konstantin wrote: Hi all! I will try to ask again(previous two posts still have no answers) : are there any site/page/docs somewhere to track actual info about @nogc support in language itself and in phobos library? Or, at least plans to extend such sup

Re: How to allocate/free memory under @nogc

2020-05-21 Thread Konstantin via Digitalmars-d-learn
On Thursday, 21 May 2020 at 15:09:57 UTC, Steven Schveighoffer wrote: On 5/20/20 10:50 PM, data pulverizer wrote: how do you allocate/free memory without using the garbage collector? Use C malloc and free. Does allocating and freeing memory using `GC.malloc` and `GC.free` avoid D's garbage c

Re: How to allocate/free memory under @nogc

2020-05-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/20/20 10:50 PM, data pulverizer wrote: how do you allocate/free memory without using the garbage collector? Use C malloc and free. Does allocating and freeing memory using `GC.malloc` and `GC.free` avoid D's garbage collector? No, an allocation can trigger a collection. D does not have

Re: How to allocate/free memory under @nogc

2020-05-20 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 21 May 2020 at 02:50:22 UTC, data pulverizer wrote: Can you also confirm that `@nogc` in a class do the same thing in that class as it does for a function? I don't think it does anything in either case, but if it does anything it will just apply @nogc to each member function in th

Re: How to allocate/free memory under @nogc

2020-05-20 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 21 May 2020 at 02:50:22 UTC, data pulverizer wrote: I'm a bit puzzled about the whole `@nogc` thing. At first I thought it just switched off the garbage collector and that you had to allocate and free memory manually using `import core.memory: GC;` I tried this and it failed becaus

How to allocate/free memory under @nogc

2020-05-20 Thread data pulverizer via Digitalmars-d-learn
I'm a bit puzzled about the whole `@nogc` thing. At first I thought it just switched off the garbage collector and that you had to allocate and free memory manually using `import core.memory: GC;` I tried this and it failed because @nogc means that the function can not allocate/free memory (ht