Trying to implement a reference counting mechanism

Mike Wey mike-wey at example.com
Wed Mar 20 12:20:03 PDT 2013


On 03/19/2013 11:06 PM, Martin wrote:
> http://pastebin.com/8M2EuyfT
>
> I'm fairly new to D, but would this work? Obviously I would need to make
> my own kind of associative array that uses manual memory management to
> completely circumvent the GC, but besides that?

It looks like your refCount is off by one, i think you need to set it to 
1 in the refCountedObj function, or check for refCount < 0 before 
freeing the value.

-- 
Mike Wey


More information about the Digitalmars-d-learn mailing list