concurrent-trees icon indicating copy to clipboard operation
concurrent-trees copied to clipboard

API method to clear all values in the tree

Open grexe opened this issue 8 years ago • 3 comments

It'd be nice to have a clean way to prune a tree of all nodes, similar to Map.clear() Else it is not clear to the API user if it is enough/OK to set the tree to null.

grexe avatar Sep 28 '16 13:09 grexe

Yes this could be feasible. It doesn't seem like a big deal. I'll consider adding this in a later release, thanks!

npgall avatar Sep 28 '16 16:09 npgall

Thanks for the quick reply and for considering the little feature! And many thanks for the great implementation! Was quick to integrate and runs smoothly, search for partial keys works very fast, even for a large number of keys, like 240000.

So until then, is it enough to set the tree to null?

Niall Gallagher [email protected] schrieb am Mi., 28. Sep. 2016, 18:42:

Yes this could be feasible. It doesn't seem like a big deal. I'll consider adding this in a later release, thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/npgall/concurrent-trees/issues/20#issuecomment-250224692, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYt2Gjk3NVfOT66T_13XtO91JNmCA_Tks5qupkMgaJpZM4KI0Jh .

grexe avatar Sep 28 '16 18:09 grexe

By 'set the tree to null', do you mean to remove your application's reference to the RadixTree? If so then yes, that is enough to allow the entire tree to be garbage collected.

I was thinking about this issue a bit more, and I'm not 100% sure I would be able to implement a clear() method on the SuffixTree easily in a thread-safe manner. So I'll have to investigate this issue a bit more, to see what can be done.

npgall avatar Oct 12 '16 22:10 npgall