Re: how to allocate class without gc?

2016-01-28 Thread Basile B. via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 22:39:54 UTC, Igor wrote: But doesn't this ultimately defeat the purpose of having manual memory management if one has to add it to the GC to be scanned? You can make the LOC related to the GC optional with an additional bool template parameter and a static if,

Re: how to allocate class without gc?

2016-01-28 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 22:39:54 UTC, Igor wrote: Ultimately I want no GC dependency. Is there an article that shows how this can be done? You can link with gcstub https://github.com/D-Programming-Language/druntime/blob/master/src/gcstub/gc.d it will replace GC completely.

Re: how to allocate class without gc?

2016-01-27 Thread Igor via Digitalmars-d-learn
On Wednesday, 27 January 2016 at 06:40:00 UTC, Basile B. wrote: On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? This is more or less the same

Re: how to allocate class without gc?

2016-01-26 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? This is more or less the same answer as you've get previously except that I don't use emplace

Re: how to allocate class without gc?

2016-01-26 Thread Guillaume Piolat via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 13:56:39 UTC, Igor wrote: //ubyte[__traits(classInstanceSize, App)] buffer; auto buffer = core.stdc.stdlib.malloc(__traits(classInstanceSize, App))[0..__traits(classInstanceSize, App)]; works, so it is the ubyte line. Make sure the buffer out

Re: how to allocate class without gc?

2016-01-26 Thread Marc Schütz via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 13:56:39 UTC, Igor wrote: //ubyte[__traits(classInstanceSize, App)] buffer; auto buffer = core.stdc.stdlib.malloc(__traits(classInstanceSize, App))[0..__traits(classInstanceSize, App)]; works, so it is the ubyte line. Can you please post the f

Re: how to allocate class without gc?

2016-01-26 Thread Daniel Kozak via Digitalmars-d-learn
V Tue, 26 Jan 2016 13:56:39 + Igor via Digitalmars-d-learn napsáno: > On Tuesday, 26 January 2016 at 09:32:06 UTC, Daniel Kozak wrote: > > V Tue, 26 Jan 2016 05:47:42 + > > Igor via Digitalmars-d-learn > > napsáno: > > > >> On Tuesday, 26 January 2016 at 05:11:54 UTC, Mike Parker wrote

Re: how to allocate class without gc?

2016-01-26 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 09:32:06 UTC, Daniel Kozak wrote: V Tue, 26 Jan 2016 05:47:42 + Igor via Digitalmars-d-learn napsáno: On Tuesday, 26 January 2016 at 05:11:54 UTC, Mike Parker wrote: > [...] Can you try it with GC.disable()? //ubyte[__traits(classInstanceSize, App)] buffe

Re: how to allocate class without gc?

2016-01-26 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 09:32:06 UTC, Daniel Kozak wrote: V Tue, 26 Jan 2016 05:47:42 + Igor via Digitalmars-d-learn napsáno: [...] Can you try it with GC.disable()? Didn't change anything.

Re: how to allocate class without gc?

2016-01-26 Thread Mike via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? There are a number of different patterns discussed and illustrated with examples at http://wi

Re: how to allocate class without gc?

2016-01-26 Thread Adrian Matoga via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? There's an example of class object allocation in the std.experimental.allocator docs: // Dyn

Re: how to allocate class without gc?

2016-01-26 Thread Daniel Kozak via Digitalmars-d-learn
V Tue, 26 Jan 2016 05:47:42 + Igor via Digitalmars-d-learn napsáno: > On Tuesday, 26 January 2016 at 05:11:54 UTC, Mike Parker wrote: > > On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: > >> Is there any examples that shows how to properly allocate an > >> object of a class type w

Re: how to allocate class without gc?

2016-01-25 Thread Ali Çehreli via Digitalmars-d-learn
On 01/25/2016 09:47 PM, Igor wrote: > it fails because the string representing the name inside App is null... > Which doesn't happen when I use new. There must be something else going on. Do you see it with a simpler type? > Should it work as expected(which it isn't) new allocates and construc

Re: how to allocate class without gc?

2016-01-25 Thread Igor via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 05:11:54 UTC, Mike Parker wrote: On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? Allocate a block of memory big

Re: how to allocate class without gc?

2016-01-25 Thread Mike Parker via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 01:09:50 UTC, Igor wrote: Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired? Allocate a block of memory big enough to hold an instance of your class using whichever alloca

how to allocate class without gc?

2016-01-25 Thread Igor via Digitalmars-d-learn
Is there any examples that shows how to properly allocate an object of a class type with the new allocators and then release it when desired?