I had an issue where KD_TREE::InitTreeNode() didn't get valid mutex from pthread_mutex_init() because it ran out of handles (it returned nullptr and crashed later when accessing nullptr mutex pointer). Then I noticed that push_down_mutex_lock is never destroyed when KD_TREE_NODE is deleted.
I added pthread_mutex_destroy( &(*root)->push_down_mutex_lock ); to KD_TREE::delete_tree_nodes() and the problem went away. So currently it leaks mutex handles which you may ran out of if you create/delete lot of nodes.
I had an issue where
KD_TREE::InitTreeNode()didn't get valid mutex frompthread_mutex_init()because it ran out of handles (it returned nullptr and crashed later when accessing nullptr mutex pointer). Then I noticed thatpush_down_mutex_lockis never destroyed whenKD_TREE_NODEis deleted.I added
pthread_mutex_destroy( &(*root)->push_down_mutex_lock );toKD_TREE::delete_tree_nodes()and the problem went away. So currently it leaks mutex handles which you may ran out of if you create/delete lot of nodes.