Cxx.jl icon indicating copy to clipboard operation
Cxx.jl copied to clipboard

GC/destruction segfault

Open iamed2 opened this issue 8 years ago • 4 comments

Something is segfaulting when the gc runs and things are destroyed in Cxx.destruct. I'm not sure what, and it may be my fault, so I reduced to a small test file and put that in a gist.

I may be doing something wrong with the C++ code, but I made a similar example in C++ and it did not segfault. I am probably very bad at C++ though (AWSCxx is the most C++ I've ever written).

https://gist.github.com/iamed2/e32162dda0ddb6a0ac3746acaabbe68f

iamed2 avatar Dec 02 '16 20:12 iamed2

Sometimes C++ code has assumptions on destruction time that are not obeyed by julia code. I'll take a look at your code later and see if that's what's happening here.

Keno avatar Dec 02 '16 20:12 Keno

Thank you very much!

iamed2 avatar Dec 02 '16 20:12 iamed2

@keno Had a chance to look at this yet?

iamed2 avatar Dec 08 '16 15:12 iamed2

A discovery: if I change this line:

cpp_key = icxx"$iterator->first;"

to this line:

cpp_key = icxx"""auto key_item = $iterator->first;
    key_item;"""

the problem goes away.

iamed2 avatar Dec 17 '16 15:12 iamed2