RefCounted

JG someone at somewhere.com
Wed Apr 13 21:15:13 UTC 2022


On Wednesday, 13 April 2022 at 20:47:33 UTC, JG wrote:
> Hi,
>
> I would have thought that RefCounted!(T, 
> RefCountedAutoInitialize.no) is to be used in place T* when I 
> want reference counting instead of the usual garbage collection 
> (or manual allocation). Perhaps this is wrong?
>
> [...]

Perhaps I should have added in case it is relevant, I am not 
actually interested in building lists. I eventually want to use 
this in a "persistent" version of a red black tree (where if r is 
such a tree and we set r1=r.insert(x) then r is unaffected and r1 
has the new element inserted - but they share most nodes). This 
data structure is to be used in a multithreaded application 
searching for a solution to some problem. The current version has 
bad performance seemingly due to gc stopping all threads while 
freeing unused nodes.


More information about the Digitalmars-d-learn mailing list