stub out your gc without hacking on druntime

Simen Kjaeraas simen.kjaras at gmail.com
Tue Jun 11 00:16:56 PDT 2013


On Tue, 11 Jun 2013 05:06:53 +0200, H. S. Teoh <hsteoh at quickfur.ath.cx>  
wrote:

>> void gc_init() { }
>> void gc_addRange() { }
>> void gc_term() { }
>
> Should these return errors too? Or is this just a quick-n-dirty way to
> get a no-GC environment without needing hack druntime?

They should not return errors. Basically, these turn gc initialization
(which druntime does at startup) and gc termination (which druntime does
at close time) into no-ops. Stubbing out gc_addRange makes sure the GC
does not try to track anything.


> Hmm. What if the user code instantiates classes? Will they leak memory
> then? Though I suppose the point is really just to find *hidden*
> allocations, and 'new' is a pretty blatant use of the GC.

They will leak, yes:

On Mon, 10 Jun 2013 21:16:04 +0200, Adam D. Ruppe  
<destructionator at gmail.com> wrote:

> // this also makes new class available to user code, but remember to  
> free your classes and call the destructor:

-- 
Simen


More information about the Digitalmars-d mailing list