Skip to content

Better memory management (and more!)

Latest
Compare
Choose a tag to compare
@facontidavide facontidavide released this 10 Nov 16:15
· 5 commits to main since this release

This is a very important release. If you can, you should upgrade!

Split "core" into multiple header files

I was quite happy with bonxai.hpp being a single, self-contained header file, but as complexity grows, it is time to move to multiple files.

In future releases I may add an "amalgameted file".

Bonxai, release my memory !

While using Bonxai I realized that sometimes the application keeps using memory, even when the data structure is deleted.

Wondering if I have a memory leak, I started analyzing the app with the usual tools: valgrind, heaptrack and address sanitizers.

Everything looks fine! Still, the memory was "there".

Then, I found this article: https://lemire.me/blog/2020/03/03/calling-free-or-delete/

And "boom"! That was the problem: malloc keeps the memory allocated when it does very small allocations! To fix this problem I now use a simplistic memory pool that allocates bigger chunks of memory.

Speed is still the same, but as expected, memory is returned to the operating system when a large VoxelGrids are deleted.

Added BinaryVoxelGrid

This is a specialization of VoxelGrid where each cell can only be On or Off, but contains no value.
If that is your case, this BinaryVoxelGrid will use considerably less memory!