You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instantiating Foo with a temporary as in the first call leads to invalid reads that trace back to evalMetric in nanoflann. The invalid read does not show up in the second instantiation of Foo. Similarly the call to foobar does not cause an issue.
Seems more related to third party libs, but it would be great if we could catch these subtleties somehow. Lost quite some time over this one.
The text was updated successfully, but these errors were encountered:
I think I understand what might be the issue. cilantro::KDTreeDataAdaptors takes an Eigen::Map and remaps the memory to a new matrix. Passing it as a temporary to the constructor means the temporary will be destroyed after the call to the constructor. Hence, the Eigen::Map is now pointing to unallocated memory. Tricky...
Yes, KDTree needs the point set to be 'alive'. Maybe we could just disable building from temporaries or use some Eigen::Ref-like mechanism to keep them alive? Any suggestions are welcome! :D
I encountered strange behavior related to Eigen and nanoflann in cilantro. Consider the following example.
Instantiating
Foo
with a temporary as in the first call leads to invalid reads that trace back toevalMetric
in nanoflann. The invalid read does not show up in the second instantiation ofFoo
. Similarly the call tofoobar
does not cause an issue.Seems more related to third party libs, but it would be great if we could catch these subtleties somehow. Lost quite some time over this one.
The text was updated successfully, but these errors were encountered: