[self-interest] Re: Memory allocation

Gordon Cichon gordon at cichon.de
Fri Jul 9 16:07:13 UTC 1999


Douglas Atique wrote:

> So, Gordon, is it only a matter of convenience? I mean, could all memory
> allocated from ResourceAreas be allocated from CHeaps, for example?
> For Self objects, on the other hand, I couldn't think of a better allocation
> scheme than the garbage-collected allocation, as there is no explicit mechanism
> in Self to destroy an object.

Yes, it is mostly a matter of convenience. The stack keeps additionally some
notion where or when the memory is allocated. F. e. when traversing a syntax
tree, an arbitrary amount of memory can be allocated at each node that can
be easily deallocated without knowing what everything was allocated initially.
This is the same what the garbage collector does, with one restriction: allocation

and deallocation must happen in a strict FIFO order.

A garbage collected heap is even more convenient than a stack because you
don't have to worry about FIFO order any more. On the other side, it is also
less efficient and causes a lot of overhead for the garbage collector. The Self
compiler is written in C++ which does not have convenient garbage collection
anyway. So it uses these ResourceAreas. That's one reason why the Self
compiler is so fast.

I remember there is some research effort going on to let an optimizing compiler
find situations where other allocation strategies can be applied other than the
GCed heap. (Correct me if I'm wrong, I think it is Urs Hözle)

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