<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>Thanks, Robby and Synx, for your feedback. I think I'm sorted now. Comments below:</div><div><br></div><div>Synx wrote:</div><blockquote type="cite"><div>Dave Gurnell wrote:<br><blockquote type="cite">Is there a simple way of estimating the number of bytes of RAM that a particular piece of data is occupying?</blockquote><font class="Apple-style-span" color="#006312"><br></font>That would be simple, until you consider the case of some joker making a<br>piece of data as (list (current-custodian)). What's the size of that?<br>Your entire memory! The problem is that structured data doesn't actually<br>contain the data, only a pointer to that data. Determining the size of<br>the pointers isn't often useful, but determining the size of the data<br>risks that your data structures end up encompassing the entire computer,<br>since though a structure can't easily hold everything, it can easily<br>point to everything.<br></div></blockquote><div><br></div><div>Understood. Fortunately I'm not trying to solve anything that general, although that explains why there aren't built-in procedures to do the job.</div><div><br></div><div>My data is pretty much the simple primitives, lists, vectors, hashes, structs and objects. I've adapted my simple memoized breadth-first algorithm with Robby's figures and that'll probably do me for now.</div><br><blockquote type="cite"><div>(sizeof (make-thingy (current-custodian) (current-continuation-marks)<br>(current-eventspace)) =&gt; ?<br><br>It would be much better for you to just measure the memory before and<br>afterwards [...]<br></div></blockquote><div><br></div><div>Yes. We have some logging in place like this to measure the minute-by-minute memory consumption of the web server. However, I need a little more detail to try and optimise specific bits of application. Hopefully a combined approach (minute-by-minute recording of current-memory-use combined with page-by-page estimates of the size of specific data structures) will do the job.</div><div><br></div><div>-- Dave</div><div><br></div></div></body></html>