Trying to implement a reference counting mechanism
Martin
martinbbjerregaard at gmail.com
Wed Mar 20 12:25:03 PDT 2013
On Wednesday, 20 March 2013 at 19:19:09 UTC, Mike Wey wrote:
> 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.
Oh, my bad, I actually had that in the code, but when I
copy/pasted it on pastebin, I had to remove some comments n stuff
and I accidentally removed it along with a "import std.conv".
More information about the Digitalmars-d-learn
mailing list