Reduce overhead in memory usage (avoid calls of calloc(..) and free(..) on intermediate steps of building the kd-tree)