<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">In my case I have an object that contains all structures and data for a whole musical composition.<div>parts, measures, notes, pitchvalues mapping tables...</div><div>It would be good to be able to see the "footprint" of different types of solution.</div><div>as you are always confronted with either big size and high speed, or smaller size and more calculations and then slower speed.</div><div><br></div><div>sincerely</div><div>joakim</div><div><br></div><div><br><div><div>Le 12 avr. 10 à 06:45, Gary Byers a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>When people ask questions like this, they usually means something<br>like "what's the total size of this object, plus the size of all things that<br>it transitively and uniquely references ?"<br><br>Another way of asking that is to ask "if the object in question became garbage, how<br>much memory would be freed by the GC ?"<br><br>(let* ((obj (make-instance ...)))<br> (gc)<br> (let* ((with-obj (%precise-size-of-allocated-memory-at-the-moment)))<br> (setq obj nil)<br> (gc)<br> (let* ((without-obj (%precise-size-of-allocated-memory-at-the-moment)))<br> (- with-obj without-obj))))<br><br>There's no such function as the one that I'm calling %PRECISE-SIZE-OF-ALLOCATED-MEMORY-AT-THE-MOMENT; it's very hard to measure this in CCL (because of threads and because of other issues.) We're also assuming that OBJ is the only thing that becomes garbage between the two GCs, and we're assuming that that object isn't sitting in some machine register even after we set the variable OBJ to NIL. Neither of those assumptions is valid.<br><br>I don't want to say that there's no reliable way to answer this question in general, but it's much, much harder to answer than it might appear to be at first glance.<br><br>There are some heap-analysis utilities described at <<a href="http://trac.clozure.com/ccl/wiki/MemoryUtils">http://trac.clozure.com/ccl/wiki/MemoryUtils</a>> (some of them are currently x8664-Linux-specific); none of them try to answer this question, but they do try to answer some similar questions.<br><br><br><br>--On April 11, 2010 4:50:23 PM +0200 Joakim Sandgren <<a href="mailto:joakim@joakimsandgren.com">joakim@joakimsandgren.com</a>> wrote:<br><br><blockquote type="cite">Hi,<br></blockquote><blockquote type="cite">Are there a way to see how big in Kb or bytes a clos object is ?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">sincerely<br></blockquote><blockquote type="cite">joakim<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Joakim Sandgren<br></blockquote><blockquote type="cite">joakim sandgren musik<br></blockquote><blockquote type="cite">42, rue de Maubeuge<br></blockquote><blockquote type="cite">75009 Paris<br></blockquote><blockquote type="cite">France<br></blockquote><blockquote type="cite">+33 (0)1 45 26 43 90<br></blockquote><blockquote type="cite"><a href="mailto:info@joakimsandgren.com">info@joakimsandgren.com</a><br></blockquote><blockquote type="cite"><a href="http://www.joakimsandgren.com">http://www.joakimsandgren.com</a><br></blockquote><br><br><br><br></div></blockquote></div><br><div> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div><font class="Apple-style-span" color="#595959" face="'Trebuchet MS'"><br class="Apple-interchange-newline"><br></font></div><div><font class="Apple-style-span" color="#595959" face="'Trebuchet MS'"><br></font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">Joakim Sandgren</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">joakim sandgren musik</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">42, rue de Maubeuge</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">75009 Paris</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">France</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959">+33 (0)1 45 26 43 90</font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959"><a href="mailto:info@joakimsandgren.com">info@joakimsandgren.com</a></font></div><div><font class="Apple-style-span" face="'Trebuchet MS'" color="#595959"><a href="http://www.joakimsandgren.com/">http://www.joakimsandgren.com</a></font></div></span> </div><br></div></body></html>