[Openmcl-devel] memory

Gary Byers gb at clozure.com
Tue Apr 13 03:42:05 PDT 2010



On Tue, 13 Apr 2010, Joakim Sandgren wrote:

> This I could do. I already make my own "deep-copy" functions.With the Sizeof
> function proposed by A. Repenning it could give me an idea of a size.
> I think I could try to handle myself the case where I have the real instance
> or a pointer. 
> I think its quite "tactile" my object. I have staff, section, partial
> section, measure, partial measure ,note group, note. 
> all these are (what I understand) "real" instances. but then for example in
> the notes I have next note and preceding note, wich is then referenced. 
> so when I do the walker I dont look at them...
> And in the end in all the slots there are integers or floats..., or Strings.
> How do I get the size of a string ? length * x.

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.

For STRINGs that aren't SIMPLE-STRINGs, the answer's more complicated.  The
STRING will be a fixed-sized object that (possibly transitively) refers
to some SIMPLE-STRING.  SIZEOF would return a consistent answer on such
a string (whatever that answer is depends on word size), but it may not
be a particularly interesting answer (and would have nothing to do with
the length of the string.)

This probably counts as another example of a "somewhat opaque implementation-
level data structure."

> 
> Very sincerely
> 
> Joakim
>


More information about the Openmcl-devel mailing list