Subject: Re: memory functions in lisp similar to sizeof, malloc etc. of C
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 14 Apr 2007 04:12:13 -0500
Newsgroups: comp.lang.lisp
Message-ID: <Zu2dneaPdO9wB73bnZ2dnUVZ_jKdnZ2d@speakeasy.net>
Aman Goel  <aman@cleartrip.com> wrote:
+---------------
| But I am a little surprised by the fact that lisp doesn't
| natively support finding size of objects in memory.
+---------------

Remember that "Lisp", or as we mostly talk about here, Common Lisp,
is *not* a single implementation, but a specification of syntax
and semantics. The ANSI Common Lisp Standard, in particular, goes
to great lengths *not* to constrain the implementation of any
particular feature beyond the minimum necessary to ensure the
desired semantics (roughly). In particular, there is no requirement
whatsoever that any given CL object be represented as a fixed-size
contiguous string of bits in memory, and in fact, many CL types
are *not* so represented in most implementations. So what would
"the" size of an object be, given that its size can vary at runtime
*without* changing the object's identity?!? -- which, for some
implementations and some objects, it can. [Hint: Hash tables.]
[Hint#2: Streams.] [Hint#3: CLOS objects.]


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607