AcademySoftwareFoundation / AcademySoftwareFoundation/openvdb
[BUG] Memory allocation issue whenever number of voxels increases a certain threshold.
- Dominant language
- C++
- Stars
- 3.4k
- Forks
- 774
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 34
Description
### Environment
**Operating System: Ubuntu 20.04.5 via nix-env
**Version / Commit SHA: 9.1 found in nux-env unstable channel
**Other: GCC 11.2, cmake 3.21
### Describe the bug
I'm collaborating on the development of an open-source program ([recut](https://github.com/UCLA-VAST/recut)) that is a program to reconstruct neurons using terabyte-size 3D images of the mouse brain. We use OpenVDB and hit a wall at the moment. Whenever the number of voxel sizes increases more than a certain number, some OpenVDB functions start to find trouble allocating memory. This problem happens in spite of the fact that our computer has 4TB of RAM and our runs barely hit the 1TB ram usage.
The following image shows the gdb output of one of the runs in which our program froze reaching `segmentActiveVoxels` function of OpenVDB.

I'm not a gdb wizard by to my understanding this is a memory allocation issue.
### To Reproduce
Steps to reproduce the behavior:
I might be able to produce a test code as needed.
### Expected behavior
`segmentActiveVoxels` works fine whenever the number of voxels is smaller than ~700,000,000. The program froze when the voxel numbers were more than ~800,000,000.
We expected voxel numbers smaller than 2^32 to work at least, although we can definitely use more voxel numbers if that works.
### Additional context
This is a very important university project. :)
The testing hardware is a dual-socket HGX server equipped with AMD Epic CPUs.
Contributor guide
Research direction
The report identifies segmentActiveVoxels as the point where the run freezes, with failures reported above roughly 800,000,000 voxels on Ubuntu 20.04.5 using OpenVDB 9.1, GCC 11.2, and CMake 3.21. Start by obtaining the promised minimal reproduction and examining the allocation failure under gdb; done means the reported voxel range completes without the memory-allocation failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100