<br><br><div class="gmail_quote">On Wed, Apr 4, 2012 at 8:55 AM, Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com">marianopeck@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><br><br><div class="gmail_quote">On Wed, Apr 4, 2012 at 5:32 PM, Mariano Martinez Peck <span dir="ltr">&lt;<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@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">

Hi guys. I noticed that there is a limit in the number of objects you can become. In my case, I am becoming 2312157 objects. So..I don&#39;t expect that the become works. I imagine that it was not designed for so many objects in mind ;)<br>


However, what I would really understand is where is the limitation and the reason.</blockquote></div></blockquote><div><br></div><div><br></div><span class="Apple-style-span" style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><div>
<br></div></span><div><span class="Apple-style-span" style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px">The limitation is in the number of forwarding blocks.  For a two-way become you need N * 2 forwarding blocks.  for a become forward 1-way become you need N forwarding blocks.  Each forwarding block takes two words (a saved header word and the new location).  During forwarding each forwarded object&#39;s header is changed to a pointer to its forwarding block.  See prepareForwardingTableForBecoming:with:twoWay: &amp; fwdTableInit:.  The number of forwarding blocks available depend on the amount of unused heap memory.   So there is no fixed limit and growing memory will lift the limit, as may doing a GC (as you yourself found).</span></div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
 And of course, if someone already knows which is the real number limit. Otherwise, I will do a kind of binary search and discover it. <br>

<br>If you want to reproduce it:<br><br>| dict |<br>dict := Dictionary new.<br>2312157 timesRepeat: [ dict at: Object new put: Object new ]. <br>3 timesRepeat: [Smalltalk garbageCollect].<br>dict keys elementsForwardIdentityTo: dict values.<br>


<br>throws a #primitiveFailed.     <br></blockquote><div><br>Of course the following works correctly:<br><br>| dict tmp |<br>dict := Dictionary new.<br>2312157 timesRepeat: [dict at: Object new put: Object new].<br>3 timesRepeat: [Smalltalk garbageCollect].<br>

dict associations groupsOf: 50000 atATimeDo: [:each |<br>    tmp := Dictionary withAll: each. <br>    tmp keys elementsForwardIdentityTo: tmp values<br>    ]<br><br><br>So... indeed, there seems to be a limit with the amount of objects. <br>

<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>Thanks,<span><font color="#888888"><br><br>-- <br>Mariano<br><a href="http://marianopeck.wordpress.com" target="_blank">http://marianopeck.wordpress.com</a><br>

<br>
</font></span></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>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>