A few questions regarding GC.malloc

monarch_dodra via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 25 14:43:52 PDT 2014


On Thursday, 25 September 2014 at 20:58:29 UTC, Gary Willoughby 
wrote:
> A few questions regarding GC.malloc.
>
> When requesting a chunk of memory from GC.malloc am i right in 
> assuming that this chunk is scanned for pointers to other GC 
> resources in order to make decisions whether to collect them or 
> not?

By default, yes, but you can use BlkAttr.NO_SCAN if you do not 
want that (eg, if you want to store integers). As a rule of 
thumb, you can use hasIndirections!T to know if or if not to scan 
(that's what most of phobos relies on).

> What does BlkAttr.FINALIZE do when used in the GC.malloc call?

I have no idea. I think its for classes though, since we 
(currently) don't finalize structs anyways.


More information about the Digitalmars-d-learn mailing list