how to allocate class without gc?

Daniel Kozak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jan 26 06:26:23 PST 2016


V Tue, 26 Jan 2016 13:56:39 +0000
Igor via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
napsáno:

> On Tuesday, 26 January 2016 at 09:32:06 UTC, Daniel Kozak wrote:
> > V Tue, 26 Jan 2016 05:47:42 +0000
> > Igor via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
> > 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)] buffer;
> auto buffer = core.stdc.stdlib.malloc(__traits(classInstanceSize, 
> App))[0..__traits(classInstanceSize, App)];
> 
> works, so it is the ubyte line.
> 		

What about:

auto buffer = new ubyte[__traits(classInstanceSize, App)];



More information about the Digitalmars-d-learn mailing list