spotify / voyager

🛰️ An approximate nearest-neighbor search library for Python and Java with a focus on ease of use, simplicity, and deployability.
https://spotify.github.io/voyager/
Apache License 2.0
1.26k stars 51 forks source link

call C++ destructor instead of free #21

Closed dylanrb123 closed 11 months ago

dylanrb123 commented 11 months ago

free will just free the memory for the pointer itself, by calling the native destructor it should actually free the underlying memory.

dylanrb123 commented 11 months ago

Tested this locally by building the JAR and loading that in a small java app that loads a large (14gb) index, closes it, and then just hangs. Monitoring the mem usage I was able to see it reclaim the memory as expected. Before this change even after the index was closed the memory was not released.