<br><br><div class="gmail_quote">On Mon, Sep 27, 2010 at 12:20 PM, Mariano Martinez Peck <span dir="ltr"><<a href="mailto:marianopeck@gmail.com">marianopeck@gmail.com</a>></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"><<a href="mailto:marianopeck@gmail.com" target="_blank">marianopeck@gmail.com</a>></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"><<a href="mailto:henrik.s.johansen@veloxit.no" target="_blank">henrik.s.johansen@veloxit.no</a>></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>
> Some notes:<br>
><br>
> - What should be answered for small ints? 1 sizeInMemory -->8. That's wrong. Shouldn't this answer 0?<br>
<br>
</div>Philosophical question really, imo both 4 (Again, in 32bit images at least) and 0 would be "correct" 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's why I thoguht 0 was better, since I want the really occupated memory. On the other hand, if you do "4 sizeInMemory" 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 >> spaceForInstances<br> | totalSize |<br> totalSize := 0.<br> self allInstancesDo: [ :inst |<br> totalSize := totalSize + inst sizeInMemory.<br> ].<br> ^ totalSize <br> <br>SmallInteger spaceForInstances ->> 0<br>
<br>So I don'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>
><br>
> - 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: 'tally'<br>
classVariableNames: ''<br>
poolDictionaries: ''<br>
category: 'Collections-Arrayed'<br>
<br>
TallyArray instSize 1<br>
(TallyArray new: 5) basicSize 5<br>
<br>
Sure, they're not used very often in Squeak/Pharo since become: is so slow, but there's no theoretical reason why you can't for example implement Set as a variable subclass with a tally inst var.<br>
<div><br>
><br>
> - Please remove the inline comment "inst vars"; 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>