From: ·····@labs-n.bbn.com
Subject: RE: Size of objects in LUCID ?
Date: 
Message-ID: <3331rl$9al@info-server.bbn.com>
In article <················@btmpdr.be> ········@btmpdr.be (Hinssen Peter) writes:
--> We're working in LUCID Common Lisp, and have to try to estimate the
--> size of e.g. a hash-table in bytes.
--> 
--> If we use the (hash-table-size) function, it only gives us the number
--> of entries that the table can hold.
--> 
--> Is there a simple way to check the physical size (in bytes) of hash-tables,
--> or other objects for that matter in Lisp?
--> 
--> Thanks,
--> Peter Hinssen
--> Alcatel BELL research labs
--> 
--> 

you seem to be implying that the table's size is equivalent to the
composite size of all the elements...since ANYTHING can go into a
hash-table as an element, that isn't really possible.

in a simpler case, you could do something like this:

(let ((*standard-output* (make-string-output-stream)))
  (maphash #'print <your-hash-table>)
  (length *standard-output*)
  )

(ok, that's probably wrong about length, but I never use those kind of
streams)

this technique isn't completely right either, because other things like
arrays and clos instances won' necessarily print full-size either, but
at least an array has an easily estimatable size...

 -- clint