Accessing Object Memory

Stephen Pair spair at advantive.com
Mon Nov 12 19:13:58 UTC 2001


AFAIK you cannot access the OOP of an object from Smalltalk in Squeak.
But, even if you could, it would not be of any use to you because an
objects' OOP can change at any time due to object memory compaction that
usually happens in conjunction with a garbage collect.  You would need
to hook into GC to change your pointer every time your object was
re-located.

- Stephen 


-----Original Message-----
From: squeak-dev-admin at lists.squeakfoundation.org
[mailto:squeak-dev-admin at lists.squeakfoundation.org] On Behalf Of Jack
Newton
Sent: Monday, November 12, 2001 1:39 PM
To: squeak-dev at lists.squeakfoundation.org
Subject: Accessing Object Memory


Hi,

I've searched everywhere I can think of to find an answer to this
question, but to no avail.  I'd really appreciate it if someone on this
list could give me a hand.

I'm interested in storing a reference to a Smalltalk object in a 32 bit
word array.  A seemingly convenient way to do this would be to store the
object pointer for the object into the array, then later retrieve the
object given its object pointer by accessing Squeak's object memory.

Objects provide an asOop method, which solves half the problem.
Although there is an ObjectMemory class that seems to provide the
services I'd need to retrieve an object, I can't find a way to access
the instance of ObjectMemory that Squeak actually uses.  

Does anyone know if it is possible to access Squeak's object memory
directly?

Many thanks,
Jack





More information about the Squeak-dev mailing list