[Q]Populating magma with a large tree

Martin Drautzburg martin.drautzburg at web.de
Wed Sep 3 08:57:51 UTC 2003


Chris Muller <afunkyobject at yahoo.com> writes:

 
> A MagmaCollection is just like any other Collection in terms of referencing
> objects, so yes, it is in there.  If you added your node to an
> OrderedCollection then it would be in your Tree as well as the
> OrderedCollection.  Removing the node from your Tree would not remove it from
> the OrderedCollection, and it would not be gc'd, since it is still referenced
> by the OrderedCollection.

For a normal Collection I understand this. But a MagmaCollection is
nothing I would want to hold in memory. 

Suppose I have a million tree nodes and all of them are in the
AllNodes MagmaCollection. I remove all references in memory, so I have
zero nodes in memory. Then I traverse the tree from Magma root until I
hit a leaf. If I have to go 6 levels I will have a minimum 6 Nodes in
memory by then. I didn't touch the AllNodes MagmaCollection so far.

When I remove the leaf from the AllNodes Collection, how many nodes
will materialize ? None (because the only node I need is already in
memory) or a million ?

What happens if I ask AllNodes size. Will any nodes materialize ?



More information about the Squeak-dev mailing list