Remove cached Change subNodes on Node completion

Previously when a TaskTree Node's subNodes required a reload, they were
cached until the Node was refreshed which was the next time the Nodes
was used, which can be many changes later, or never. On Node refresh, it
would finally dump any Change subNodes, which are unreusable, that it
had. Since these Change subNodes would not be re-used, they just
consumed extra memory which could be significant if they had a full
subtree such as would be the case when walking each change's ancestors.
Avoid caching these Change subNodes by clearing them as soon as the node
processing is complete.

Before this change, a task.config which walks all dependencies for a
change would not complete after an hour with a 58000m heap when run with
status:open --no-limit. At the time of attempting to run the query, it
is visible that lots of CPU is being spent using top, more than a 1000%,
likely for java GC. After this change it completes in around 30mins
(5800m) heap, and 50mins (48000m) heap!

Change-Id: I88c3862e886e016b5731c8074da810da20480e47
1 file changed