<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">This I could do. I already make my own "deep-copy" functions.<div>With the Sizeof function proposed by A. Repenning it could give me an idea of a size.</div><div>I think I could try to handle myself the case where I have the real instance or a pointer. </div><div>I think its quite "tactile" my object. I have staff, section, partial section, measure, partial measure ,note group, note. </div><div>all these are (what I understand) "real" instances. but then for example in the notes I have next note and preceding note, wich is then referenced. </div><div>so when I do the walker I dont look at them...</div><div>And in the end in all the slots there are integers or floats..., or Strings. How do I get the size of a string ? length * x.</div><div><br></div><div>Very sincerely</div><div><br></div><div>Joakim</div><div><br><div><div>Le 12 avr. 10 à 20:22, Bill St. Clair a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>It seems to me that what you need would be partially your own recursive<br>data structure walker and partly a CCL-provided SIZEOF generic function.<br>The SIZEOF generic function would take a single argument and return the<br>number of bytes used by that object alone, but not anything it<br>references. Your function would walk one of your data structures,<br>calling sizeof on each Lisp object that you consider to be part of that<br>one user-level data structure and summing all the results.<br><br>I sent in my last reply the code for SIZEOF on a CCL standard CLOS<br>instance. Adding a full-featured SIZEOF generic function to CCL would<br>likely be useful, and is probably not very difficult. You could do it<br>yourself with a little routing around in the CCL source code. Or maybe<br>somebody else on the list would like to make a portable version.<br><br>-Bill<br><br>On 4/12/10 10:16AM, Joakim Sandgren wrote:<br><blockquote type="cite">In my case I have an object that contains all structures and data for a<br></blockquote><blockquote type="cite">whole musical composition.<br></blockquote><blockquote type="cite">parts, measures, notes, pitchvalues mapping tables...<br></blockquote><blockquote type="cite">It would be good to be able to see the "footprint" of different types of<br></blockquote><blockquote type="cite">solution.<br></blockquote><blockquote type="cite">as you are always confronted with either big size and high speed, or<br></blockquote><blockquote type="cite">smaller size and more calculations and then slower speed.<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">Le 12 avr. 10 à 06:45, Gary Byers a écrit :<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">When people ask questions like this, they usually means something<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">like "what's the total size of this object, plus the size of all<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">things that<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">it transitively and uniquely references ?"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Another way of asking that is to ask "if the object in question became<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">garbage, how<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">much memory would be freed by the GC ?"<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">(let* ((obj (make-instance ...)))<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">(gc)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">(let* ((with-obj (%precise-size-of-allocated-memory-at-the-moment)))<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> (setq obj nil)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> (gc)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> (let* ((without-obj (%precise-size-of-allocated-memory-at-the-moment)))<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> (- with-obj without-obj))))<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">There's no such function as the one that I'm calling<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">%PRECISE-SIZE-OF-ALLOCATED-MEMORY-AT-THE-MOMENT; it's very hard to<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">measure this in CCL (because of threads and because of other issues.)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> We're also assuming that OBJ is the only thing that becomes garbage<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">between the two GCs, and we're assuming that that object isn't sitting<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">in some machine register even after we set the variable OBJ to NIL.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> Neither of those assumptions is valid.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I don't want to say that there's no reliable way to answer this<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">question in general, but it's much, much harder to answer than it<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">might appear to be at first glance.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">There are some heap-analysis utilities described at<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><<a href="http://trac.clozure.com/ccl/wiki/MemoryUtils">http://trac.clozure.com/ccl/wiki/MemoryUtils</a>> (some of them are<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">currently x8664-Linux-specific); none of them try to answer this<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">question, but they do try to answer some similar questions.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">--On April 11, 2010 4:50:23 PM +0200 Joakim Sandgren<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><joakim@joakimsandgren.com <<a href="mailto:joakim@joakimsandgren.com">mailto:joakim@joakimsandgren.com</a>>> wrote:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Hi,<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Are there a way to see how big in Kb or bytes a clos object is ?<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">sincerely<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">joakim<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">Joakim Sandgren<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">joakim sandgren musik<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">42, rue de Maubeuge<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">75009 Paris<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">France<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">+33 (0)1 45 26 43 90<br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">info@joakimsandgren.com <<a href="mailto:info@joakimsandgren.com">mailto:info@joakimsandgren.com</a>><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><a href="http://www.joakimsandgren.com">http://www.joakimsandgren.com</a><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></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">info@joakimsandgren.com <<a href="mailto:info@joakimsandgren.com">mailto:info@joakimsandgren.com</a>><br></blockquote><blockquote type="cite">http://www.joakimsandgren.com <<a href="http://www.joakimsandgren.com/">http://www.joakimsandgren.com/</a>><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">Openmcl-devel mailing list<br></blockquote><blockquote type="cite"><a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br></blockquote><blockquote type="cite"><a href="http://clozure.com/mailman/listinfo/openmcl-devel">http://clozure.com/mailman/listinfo/openmcl-devel</a><br></blockquote><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>