<br><br><div class="gmail_quote">On Mon, Sep 27, 2010 at 12:20 PM, 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, Sep 22, 2010 at 12:34 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:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">

<br><br><div class="gmail_quote"><div>On Wed, Sep 22, 2010 at 12:12 PM, Henrik Johansen <span dir="ltr">&lt;<a href="mailto:henrik.s.johansen@veloxit.no" target="_blank">henrik.s.johansen@veloxit.no</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">

<div><br>
On Sep 22, 2010, at 9:59 40AM, Adrian Lienhard wrote:<br>
<br>
&gt; Some notes:<br>
&gt;<br>
&gt; - What should be answered for small ints? 1 sizeInMemory --&gt;8. That&#39;s wrong. Shouldn&#39;t this answer 0?<br>
<br>
</div>Philosophical question really, imo both 4 (Again, in 32bit images at least) and 0 would be &quot;correct&quot; answers in their own ways. 8 is definitely wrong though :)<br>
The method comment should probably highlight which definition is used.<br>
<div><br></div></blockquote></div></div></blockquote><div><br><br>So....what should we consider for SmallInteger ?   4 bytes or 0 bytes?<br></div></div></blockquote><div><br></div><div>0 bytes, obviously.  The only space occupied by a SmallInteger is the space of the slot containing it.  There is no SmallInteger object beyond the slot.</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"><div><br>I would like to compute the really used memory.<br><br>thanks<br><br>mariano<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="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">

<div></div></blockquote></div><div><br>At the beginning I also thought to have 4, instead of 0. The problem is that if you put 4 and you have an object with and instVar that it is a SmallInteger, it will be counted twice, when actually it is only one. <br>



That&#39;s why I thoguht 0 was better, since I want the really occupated memory. On the other hand, if you do &quot;4 sizeInMemory&quot; and see zero, I have to admit it is a litlte confusing. <br><br>The problem is that if I do for example:<br>


<br>Class &gt;&gt; spaceForInstances<br>    | totalSize |<br>    totalSize := 0.<br>    self allInstancesDo: [ :inst |<br>        totalSize := totalSize + inst sizeInMemory.<br>    ].<br>    ^ totalSize <br> <br>SmallInteger spaceForInstances  -&gt;&gt;  0<br>


<br>So I don&#39;t know...maybe we have to answer 4 instead of 0?<br><br>Adrian what do you think?<br><br></div><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">



<div>
&gt;<br>
&gt; - In the line contentBytes := contentBytes + (self basicSize * bytesPerElement), why is contentBytes added because it should be always 0 because self class instSize should return 0 in case of variable classes. Or do I miss something?<br>




</div>You can have instance variables in variable classes:<br>
<br>
ArrayedCollection variableSubclass: #TallyArray<br>
        instanceVariableNames: &#39;tally&#39;<br>
        classVariableNames: &#39;&#39;<br>
        poolDictionaries: &#39;&#39;<br>
        category: &#39;Collections-Arrayed&#39;<br>
<br>
TallyArray instSize 1<br>
(TallyArray new: 5) basicSize 5<br>
<br>
Sure, they&#39;re not used very often in Squeak/Pharo since become: is so slow, but there&#39;s no theoretical reason why you can&#39;t for example implement Set as a variable subclass with a tally inst var.<br>
<div><br>
&gt;<br>
&gt; - Please remove the inline comment &quot;inst vars&quot;; if a comment is needed it should go into the main comment.<br>
</div>I agree, should be self-explanatory.<br>
<div><div></div><div><br>
Cheers,<br>
Henry<br>
_______________________________________________<br>
Pharo-project mailing list<br>
<a href="mailto:Pharo-project@lists.gforge.inria.fr" target="_blank">Pharo-project@lists.gforge.inria.fr</a><br>
<a href="http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project" target="_blank">http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project</a><br>
</div></div></blockquote></div></div><br>
</blockquote></div><br>
<br></blockquote></div><br>