mourner / rbush

RBush — a high-performance JavaScript R-tree-based 2D spatial index for points and rectangles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Leaking nodes

synthmeat opened this issue · comments

First, absolutely amazing package. Best out there.

I've spent a good part of day debugging my own code and that, combined with increased incidence of bug inversely proportional to specified maximum number of entries in a tree node, leads me to believe it might be related to this package.

To describe use case, every ~20 times a second, I update (remove/add) ~100 entities of tree with ~10000 entries, remove a few, and after a while tree.all().length seems to steadily increase. The lower maximum number of entries in tree node, the higher the incidence. In example, for 2 about 50% of nodes don't get removed, and for 64 just a few percent.

I'll make a minimal reproduction case in next few days if there's need, but just wanted to start discussion.

I've added the bug reproduction here. In the process, I've discovered that it ain't a bug. I was modifying minX, minY, maxX, or maxY before .remove().