<div dir="ltr">On 24 May 2013 15:21, deadalnix <span dir="ltr"><<a href="mailto:deadalnix@gmail.com" target="_blank">deadalnix@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Thursday, 23 May 2013 at 23:42:22 UTC, Manu wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
I've always steered away from things like this because it creates a<br>
double-indirection.<br></div><div class="im">
I have thought of making a similar RefCounted template, but where the<br>
refCount is stored in a hash table, and the pointer is used to index the<br>
table.<br>
This means the refCount doesn't pollute the class/structure being<br>
ref-counted, or avoids a double-indirection on general access.<br>
It will be slightly slower to inc/decrement, but that's a controlled<br>
operation.<br>
I would use a system like this for probably 80% of resources.<br>
<br>
</div></blockquote>
<br>
Reference counting also tend to create die in mass effect (objects tends to die in cluster) and freeze program for a while. I'm not sure it is that better (better than current D's GC for sure, but I'm not sure it is better than a good GC). It probably depends on the usage pattern.<br>

</blockquote></div><br></div><div class="gmail_extra" style>In my experience that's fine.</div><div class="gmail_extra" style>In realtime code, you tend not to allocate/deallocate at runtime. Unless it's some short lived temp's, which tend not to cluster how you describe...</div>
<div class="gmail_extra" style>When you eventually do free some big resources, causing a cluster free, you will have probably done it at an appropriate time where you intend such a thing to happen.</div></div>