That's a bit hard to say without seeing a bit more of your code, including all of the "constants" that you're using as array indexes. If any one of those constants is a large number, you're going to be wasting lots of space in each Node and Leaf.
You could do away with $cont::getType entirely. You needn't hang on to "Node" or "Leaf" in each object. Instead, use ref() to check which type of thing you're looking at, or add an isLeaf member function to each object, returning 0 or 1 as appropriate.
Also, rather than hanging an anonymous array off of [$node::leaves], you could save a bit of space by keeping a separate [$node::left] and [$node::right]. The overhead for a slot within an array is lower than the overhead for an array, even if empty.
In reply to Re: Possible Memory Usage Issues
by dws
in thread Possible Memory Usage Issues
by abitkin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |