pypoisson icon indicating copy to clipboard operation
pypoisson copied to clipboard

free

Open pengsongyou opened this issue 3 years ago • 2 comments

First, of all, thanks a lot for the amazing python binder for SPSR!

I am using Ubuntu 20.04, python=3.7.3, cython 0.29.12, GCC 7.3.

Following the readme file, I have successfully installed it. However, when I was trying to run your example folder, I encountered the error as below:

free(): double free detected in tcache 2 Aborted (core dumped)

I was trying to debug, and realize the issue happening inside this line. Then, I tried to compiled and ran examples using the original PoissonRecon V6.13 code, it also worked perfectly. Therefore, I think the problem might come when compiling with the cython?

I then changed another machine with Ubuntu 18.04, and it worked with your tool. Therefore, I am just curious what could be the possible reasons.

Thanks a lot for your effort in advance!

Best, Songyou

pengsongyou avatar Nov 29 '20 14:11 pengsongyou

I tried to figure out the case of this memory issue. While not fully successful, I have narrowed it down to this function ConstNeighborKey3::~ConstNeighborKey3.

The original PoissonRecon V6.13 code is now very old and is failing to keep up with the stricter checks of the new compilers, python, and cython. While I am not fully sure, I strongly suspect the latest gcc is putting additional constraints on how the memory is freed, and some of the old pointer-stuff is failing. This is a very useful piece of code, so if someone wants to volunteer to update all the pointer/array usage into std::vector, it would be a great community service. :-)

Immediate solution: until that happens, I was able to run this using gcc@7. I used the following. Hope this helps. It seems from comments above that others have also had success in rolling back os/gcc.

gcc-mp-7 (MacPorts gcc7 7.5.0_2) 7.5.0
Python 3.7.11
Cython version 0.29.24

bhatiaharsh avatar Jul 20 '21 23:07 bhatiaharsh

I switch to gcc-7 and recompile, then the segmentation fault disappears.

YuliangXiu avatar Nov 04 '22 20:11 YuliangXiu