[MRG] Avoid reference cycles in Tree

Fixes #2787.

~~This is a WIP because~~ we need to check if wrapping `value` with a ndarray at predict time is too expensive in time. If so, we can implement our own `take` using `memcpy` (which I'd rather over reverting to the version where `predict` duplicates `apply`) but for the moment I'm having trouble getting that to work...

This also needs to be tested for any further memory leaks.