<br><br><div class="gmail_quote">On Mon, Jul 19, 2010 at 7:35 AM, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Mariano, can you tell us, why you need to know, how many objects pointing to<br>
a specific one?<br>
The reference counting is well known solution to this, but it is less<br>
effective than garbage collection<br>
(in terms of memory management), since you have to touch the counters<br>
at each memory write.<br></blockquote><div><br></div><div>and recursively when objects are freed.</div><div><br></div><div>Further, for two reasons one will also need a scan-mark garbage collector to collect all garbage.  It is inevitable that one won&#39;t waste space on a reference count that can hold the max number of references and so the system will have to deal with a max count and have some objects with an overflowed count.  Reference counting cannot easily deal with circularities and so a cycle of references will result in non-zero ref counts for nodes in the cycle and prevent garbage collection.</div>
<div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
On 19 July 2010 12:55, Mariano Martinez Peck &lt;<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Ok...thanks for the answers...I think I will have to go in another way. But anyway, thanks<br>
&gt;<br>
&gt; mariano<br>
<div><div></div><div class="h5">&gt;<br>
&gt; On Thu, Jul 15, 2010 at 6:43 PM, Andreas Raab &lt;<a href="mailto:andreas.raab@gmx.de">andreas.raab@gmx.de</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On 7/15/2010 5:40 AM, Mariano Martinez Peck wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hi folks. I need to know the objects (actually, only how many) that are<br>
&gt;&gt;&gt; pointing to any object. So...I take an object X, and I want to know how<br>
&gt;&gt;&gt; many objects are pointing to X.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The only possible I see in Squeak VM is to do a full mark over all<br>
&gt;&gt;&gt; objects in memory (or starting by the roots). This is time consuming and<br>
&gt;&gt;&gt; I even need (maybe) to do this check (to know how many objects are<br>
&gt;&gt;&gt; pointing to an object) for every single object.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; So...is there a faster solution for this? The only thing I can imagine<br>
&gt;&gt;&gt; is to modify the object header, maybe create a new type, and add an<br>
&gt;&gt;&gt; array with the addresses of the objects that are pointing to that<br>
&gt;&gt;&gt; object. Or maybe just a counter that I can increase or decrease ?<br>
&gt;&gt;<br>
&gt;&gt; That&#39;s called &quot;reference counting&quot;. It&#39;s not supported in Squeak.<br>
&gt;&gt;<br>
&gt;&gt; Cheers,<br>
&gt;&gt;  - Andreas<br>
&gt;<br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
</div></div><font color="#888888">--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
</font></blockquote></div><br>