AcademySoftwareFoundation / openvdb

OpenVDB - Sparse volume data structure and tools
http://www.openvdb.org/
Apache License 2.0
2.75k stars 665 forks source link

'free(): invalid pointer' on import openvdb in a jupyter notebook #673

Closed infobeisel closed 4 years ago

infobeisel commented 4 years ago

i built and installed openvdb and the python bindings. when opening a normal python console and typing import openvdb or import pyopenvdb it works perfectly well. When starting a jupyter notebook (see jupyter) and running it there instead, the kernel crashes and the error log says 'free(): invalid pointer'.

By trial and error i found out the responsible lines in openvdb.cc:

//#ifdef OPENVDB_ENABLE_POINTS
#include "points/PointDataGrid.h"
//#endif
[...]
//#ifdef OPENVDB_ENABLE_POINTS
    points::internal::initialize();
//#endif
[...]
//#ifdef OPENVDB_ENABLE_POINTS
    points::internal::uninitialize();
//#endif
[...]

by removing the //s (i.e. make those ifdefs have an impact), the module compiles and runs well in jupyter. i don't know if this is a real fix though, as one might lose functionality?

kind regards

infobeisel commented 4 years ago

Of course the above changes aren't a valid fix (crashes when trying to use this malformed openvdb build are inevitable). In the meantime i fixed the problem in my case by rebuilding openvdb with the alternative dependencies (blosc and jemalloc), which includes editing the main Makefile of openvdb and pointing directly to those installed libraries, as described in this link , credits to Kevindietrich. Now i can import pyopenvdb in a jupyter environment and the kernel doesn't crash! kind regards