[self-interest] Re: Memory allocation

Gordon Cichon gordon at cichon.de
Tue Jul 6 22:10:39 UTC 1999


Douglas Atique wrote:

> As far as I know, an object can be allocated in three different ways:
> - on the C heap, that is with malloc from the OS
> - on the stack
> - on the resource area
> I understand that objects allocated on the stack are never garbage
> collected, because they are on a stack and the garbage collector doesn't

Actual Self objects are always allocated inside the object system, i.e.
the new space or eden space of the Self world. Self objects are never
allocated on the stack. The stack can only hold pointer to Self objects.
The objects itself are always loacted elsewhere. The only entity that
can be allocated from the stack are stack frames a.k.a. activation records
for Self method execution or C language calls. These things as well as
compiled code, processes and a lot of other administrative suff ("zone")
are not Self objects.

The algorithms of the garbage collector is rather complex. He knows about
how to traverse all those C++ data structures that makes up the Self system

but are not Self objects by themselves. The GC starts scanning for live
objects
at the list of active processes, propably the lobby, and some internal
constants
used by the compiler.

Nevertheless, most of the C++ data structures are acessible from the Self
level. This connection is established through additional proxy objects
(glue code).
Look at processes or stack frames, for example. There is quite a lot of
code
necessary to "lift" the C++ objects up into the Self world.

The resource areas are a special mechanism to handle the allocation of
temporary
space in a FIFO fashion. They are compareable to the obstacks used by the
Gnu CC.

Gordon.


------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/self-interest
http://www.egroups.com - Simplifying group communications






More information about the Self-interest mailing list