Smart pointers instead of GC?

Adam Wilson flyboynw at gmail.com
Sat Feb 1 19:38:07 PST 2014


On Sat, 01 Feb 2014 19:15:38 -0800, Frank Bauer <y at z.com> wrote:

> Of course, the big deal is: if I opt for ARC(T), Owning(T) and  
> Borrowed(T) exclusively, the GC has no business running for a  
> microsecond in my code or the standard library functions I call.

That's not a guarantee that can be reasonably made or demanded. You have  
no idea if a library you are using is written using the GC and turning  
those on would have no way to impact the allocation scheme of the library.  
As long as there is a possibility of a GC, D will have to pass an active  
GC instance to any libraries that are loaded.

The GC only runs right now when a GC allocation is requested. I've been  
saying this all over the forums but people seem to persist in the mindset  
that the GC is a black-box that runs at completely random intervals, for  
random intervals, all determined by voodoo and black magic. It's not, and  
it doesn't. The GC only runs when an allocation is requested that cannot  
be filled from the current available heap. If you don't use the GC, by  
definition it will not run, unless a library you depend on uses it.

-- 
Adam Wilson
GitHub/IRC: LightBender
Aurora Project Coordinator


More information about the Digitalmars-d mailing list