<br><br><div class="gmail_quote">On Mon, Jan 9, 2012 at 7:13 PM, Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@elte.hu">leves@elte.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Mon, 9 Jan 2012, Mariano Martinez Peck wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Levente. Thanks for looking into the issue. I saw your code and there is<br>
something I don't understand.<br>
<br>
pointsTo: anObject<br>
   "Answers true if the garbage collector would fail to collect anObject<br>
because I hold a reference to it, or false otherwise"<br>
<br>
   (self instVarsInclude: anObject)<br>
       ifTrue: [<br>
           self class isWeak ifFalse: [ ^true ].<br>
           1 to: self class instSize do: [ :i |<br>
               (self instVarAt: i) == anObject ifTrue: [ ^true ] ].<br>
           ^false ]<br>
       ifFalse: [ ^self class == anObject and: [ self class isCompact not<br>
] ]<br>
<br>
<br>
I don't understand the loop of<br>
<br>
           1 to: self class instSize do: [ :i |<br>
               (self instVarAt: i) == anObject ifTrue: [ ^true ] ].<br>
<br>
<br>
In which scenario can     (self instVarsInclude: anObject)  answer true,<br>
but the loop false?<br>
</blockquote>
<br></div>
The scenario happens when the receiver has weak slots and the argument is referenced from one of those weak slots, but not from the other slots.<div class="im"><br></div></blockquote><div><br>Ok, I see. And moreover, there has to be a GC in the middle, right?  so..the scenario is "The scenario happens when the receiver has weak slots, the argument 
is referenced from one of those weak slots, but not from the other 
non-weak slots, and also when a GC runs between the invokation to #instVarsInclude:  and the loop".<br>is that correct?  so that I will add this comment to the code ;)<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
doesn't #instVarsInclude do exactly what you are doing there?<br>
</blockquote>
<br></div>
Just partially. Since we have no information about which slots hold the<br>
reference to the argument, therefore this loop must be "repeated".</blockquote><div><br>Ok, I see.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Anyway, I have integrated your changes in Pharo, but still, I have the same<br>
problem :(<br>
If I understand correctly, the following shouldn't fail, but it does. Here<br>
is the version of Squeak that fails.<br>
</blockquote>
<br></div>
The assetion fails, because the indirection vector (the Array found by PointerFinder) holds a reference to the object after the first assignment to a. If you move the temporary inside the block or use an inlined loop (e.g. #to:do: with literal block argument), then the assertion won't fail. So this is just a normal (maybe surprising) reference to the object.<br>

<br></blockquote><div><br>Excellent. Now I got it. Thank you very much for your help Levente. Now PointerFinderTest are green :)<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>
Levente<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
| a |<br>
10 timesRepeat: [<br>
a := Date new.<br>
Smalltalk garbageCollect.<br>
self assert: (PointerFinder pointersTo: a) isEmpty<br>
]<br>
<br>
Thanks a lot,<br>
<br>
<br>
On Mon, Jan 9, 2012 at 2:40 PM, Levente Uzonyi <<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>> wrote:<br>
<br>
On Sun, 8 Jan 2012, Mariano Martinez Peck wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
 What I don't understand is why in Squeak it does work.<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
</blockquote>
Because #pointsTo: is not used in Squeak (yet). As usual I dug deeper<br>
than<br>
I should have, so I'll publish a few changes soon.<br>
<br>
<br>
 Ok, you are right. Squeak #inboundPointersExcluding:  is using<br>
</blockquote>
#instVarsInclude:  rather than #pointsTo. And that solves the problem in<br>
Pharo as well. But still, I would like to understand why we get those<br>
method contexts with #pointsTo.<br>
<br>
</blockquote>
<br>
Because #pointsTo: is a normal message send, it even sends other methods,<br>
so it will create contexts.<br>
<br>
<br>
 Thanks Levente for your help. If you find something let us know, I want to<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
learn :)<br>
<br>
</blockquote>
<br>
I pushed my changes to the Squeak Inbox, which fully works around this<br>
issue. The changes about weak references can simply be removed if you don't<br>
like them, the rest will just work without them.<br>
<br>
<br>
Levente<br>
<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Levente<br>
<br>
<br>
 Thanks in advance Levente!<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
<br>
<br>
<br>
<br>
 it will create at least one new MethodContext which is not included in<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
that list.<br>
<br>
<br>
Levente<br>
<br>
<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
 Levente<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
 Thanks again.<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
 Levente<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
<br>
<br>
 Do you mean what I understand :)? that some tools compiled<br>
methods?<br>
:)<br>
<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
 Stef<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
 --<br>
<br>
 Mariano<br>
</blockquote>
<a href="http://marianopeck.wordpress." target="_blank">http://marianopeck.wordpress.</a>*<u></u>*********com <<br>
<a href="http://marianopeck.wordpress" target="_blank">http://marianopeck.wordpress</a>.<br>
****<br>
com <<a href="http://marianopeck.wordpress." target="_blank">http://marianopeck.wordpress.</a><u></u>******com<<a href="http://marianopeck." target="_blank">http://marianopeck.</a>*<u></u>*<br>
<a href="http://wordpress.com" target="_blank">wordpress.com</a> <<a href="http://marianopeck.wordpress." target="_blank">http://marianopeck.wordpress.</a><u></u>**com<<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.<u></u>wordpress.com</a>><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote></blockquote>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote></blockquote>
<br>
<br>
  --<br>
</blockquote>
<br>
</blockquote><div class="im">
Mariano<br>
<a href="http://marianopeck.wordpress." target="_blank">http://marianopeck.wordpress.</a>*<u></u>*******com <<br>
<a href="http://marianopeck.wordpress" target="_blank">http://marianopeck.wordpress</a>.<br>
****<br>
com <<a href="http://marianopeck.wordpress." target="_blank">http://marianopeck.wordpress.</a><u></u>****com<<a href="http://marianopeck." target="_blank">http://marianopeck.</a>**<br>
<a href="http://wordpress.com" target="_blank">wordpress.com</a> <<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.<u></u>com</a>>><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote></blockquote>
<br>
<br>
<br>
</div></blockquote>
 --<br>
</blockquote><div class="im">
Mariano<br>
<a href="http://marianopeck.wordpress." target="_blank">http://marianopeck.wordpress.</a>*<u></u>*****com <<a href="http://marianopeck.wordpress" target="_blank">http://marianopeck.wordpress</a>.<br>
****<br>
com <<a href="http://marianopeck.wordpress." target="_blank">http://marianopeck.wordpress.</a><u></u>**com<<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.<u></u>wordpress.com</a>><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote></blockquote>
<br>
<br>
<br>
<br>
</div></blockquote>
<br>
</blockquote><div class="im">
--<br>
Mariano<br>
<a href="http://marianopeck.wordpress." target="_blank">http://marianopeck.wordpress.</a>*<u></u>***com <<a href="http://marianopeck.wordpress." target="_blank">http://marianopeck.wordpress.</a><u></u>**<br>
com <<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.<u></u>com</a>>><br>
<br>
<br>
<br>
</div></blockquote>
<br>
</blockquote><div class="im">
<br>
--<br>
Mariano<br>
<a href="http://marianopeck.wordpress." target="_blank">http://marianopeck.wordpress.</a>*<u></u>*com <<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.<u></u>com</a>><br>
<br>
<br>
</div></blockquote>
<br>
</blockquote>
<br><span class="HOEnZb"><font color="#888888">
<br>
-- <br>
Mariano<br>
<a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.<u></u>com</a><br>
<br>
</font></span></blockquote>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br><br>