Hi,
I'm experiencing an OutofMemoryError exception while recursing through a tree with a large number of branches (30) but relatively small depth (5). Here's the basic idea of the code:
I start growing the tree using a depth-first method, and after I reach the leaf node, I assign a value to the node and then recursively calculate the value of the their parent node with some formula. Ideally I hope Java's garbage collector can recycle all the memory of all the child nodes once I get the value of the parent node, as I won't have any use of them. So according to that I only need to store at most 30 * 5 nodes in the memory at any time. However apparently that is not the case, and could someone please let me know how I can recycle the memory for the recursion?
thanks,
Colin