Lisp HUG Maillist Archive

storage question

Hi,

Very basic question : I'm looking for some function or info about the
computation of storage size of objects. HCL:find-object-size return some
information but not sufficiently to know the exact size of a instance or
even a simple list...
Any links ?

Thanks

Denis

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------


FW: storage question

I'll try to be more precise :

What's the size of a list of 4 fixnums ? HCL:find-object-size return 12 for
any kind of list. Is it the size of the first cons ?
If it is, is the size of a cons of 2 fixnums 12 with the two fixnums
included ? or 12 + the size of the fixnums ?

Is the size of a list of 4 fixnums = (* 4 12) ? Or = (+ 4 (* 4 8)) ? Or ...?

I remember something about that on the mailing-list but I can't find it
now...

Any help very appreciated. Thanks !

Denis 


-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------

------ Forwarded Message
From: Denis Pousseur <denis.pousseur@gmail.com>
Date: Fri, 06 Jul 2007 16:16:42 +0200
To: Lisp Hug Lispworks <lisp-hug@lispworks.com>
Subject: storage question

Hi,

Very basic question : I'm looking for some function or info about the
computation of storage size of objects. HCL:find-object-size return some
information but not sufficiently to know the exact size of a instance or
even a simple list...
Any links ?

Thanks

Denis

-------------------------------------------------------
Denis Pousseur
70 rue de Wansijn
1180 Bruxelles, Belgique

Tel : 32 (0)2 219 31 09
Mail :  denis.pousseur@gmail.com
-------------------------------------------------------

------ End of Forwarded Message


Re: storage question

On 7 Jul 2007, at 13:36, Denis Pousseur wrote:

>
> I'll try to be more precise :
>
> What's the size of a list of 4 fixnums ? HCL:find-object-size  
> return 12 for
> any kind of list. Is it the size of the first cons ?
> If it is, is the size of a cons of 2 fixnums 12 with the two fixnums
> included ? or 12 + the size of the fixnums ?

That will be the size of a cons: a word of tag, and a word each for  
the car & cdr.  A fixnum will fit directly in the car or cdr, as will  
the terminating NIL.  So the size of a list of n fixnums is the size  
of the conses, which is n*12 bytes. Presumably bigger (and I'd guess  
2x as big - you can't need that many tag bits, but alignment  
restrictions probably mean that you need to align the pointers on 8- 
byte boundaries) for a 64bit version.

--tim


Re: storage question

On 6 Jul 2007, at 15:16, Denis Pousseur wrote:

>
> Hi,
>
> Very basic question : I'm looking for some function or info about the
> computation of storage size of objects. HCL:find-object-size return  
> some
> information but not sufficiently to know the exact size of a  
> instance or
> even a simple list...
> Any links ?
That's a fairly hard problem to solve in general: where do you stop  
counting?  For instance how do you allocate the space used up by a  
package to its symbols?  How do you count the space used by a cons  
tree which is actually a graph?

--tim


Updated at: 2020-12-10 08:45 UTC