From: Hinssen Peter
Subject: Size of objects in LUCID ?
Date: 
Message-ID: <1994Aug12.112017@btmpdr.be>
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
From: Ken Anderson
Subject: Re: Size of objects in LUCID ?
Date: 
Message-ID: <KANDERSO.94Aug23105126@wheaton.bbn.com>
In article <················@btmpdr.be> ········@btmpdr.be (Hinssen Peter) writes:

   From: ········@btmpdr.be (Hinssen Peter)

   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?

Well, a quick estimate is (* 8 (hash-table-size table)).  However, you can
get a better estimate by grabbing the array underlying the hash-table from
the inspector.  Contact me separately if you'd like the size code i have:

> (object-size (make-hash-table))
154
> (object-size (make-hash-table :size 1000))
2038
> 

k
--
Ken Anderson 
Internet: ·········@bbn.com
BBN ST               Work Phone: 617-873-3160
10 Moulton St.       Home Phone: 617-643-0157
Mail Stop 6/4a              FAX: 617-873-2794
Cambridge MA 02138
USA