[Openmcl-devel] memory

R. Matthew Emerson rme at clozure.com
Tue Apr 13 11:03:18 PDT 2010


On Apr 13, 2010, at 11:07 AM, Alexander Repenning wrote:

> On Apr 13, 2010, at 4:42 AM, Gary Byers wrote:
> 
>> The SIZEOF a SIMPLE-STRING is its length * 4, + the size of a header (4 bytes
>> in 32-bit CCL, 8 bytes in 64-bit CCL), rounded up to an object alignment boundary
>> (8/16 bytes.)  The SIZEOF function that I mailed out yesterday should know how
>> compute this value.
> 
> uvsize is a pretty handy function to compute these kinds of sizes. Overall, I prefer sizeof to be a method in order to be able to compute sizes of custom types/classes. However, Your sizeof appears to return strange results for some simple types including floats, CCL32:
> 
> ? (sizeof 3.14)
> 8
> ;; should this not be 4
> 
> ? (type-of 3.14)
> SINGLE-FLOAT
> 
> In CCL64 the result is 0 because single-floats are not uvectors and the case is not handled in your cond

In a 32-bit ccl, a single-float is a uvector.  There is a 32-bit header, and another 32-bit word that contains the actual bits that represent the float.  That's where the answer of 8 bytes comes up.

On a 64-bit ccl, a single float is an immediate quantity, like a fixnum or a character.  (The float bits are stored in the upper 4 bytes of a 64-bit word.)




More information about the Openmcl-devel mailing list