On my System (64bit Ubuntu, Matlab R2009a) there seems to be a memory leak with this implementation:
for i = 1:1000
tree = kdtree_build(rand(1000,1));
grabs around 140MB of system memory, according to top. That is never released again. Do I have to release the resources myself in some way or might this be a bug?
I really depend on this implementation, so you would do me a great favour by having a look at it...