Let's say I have a program which returns
data = ccall(getcfunction())
data is a pointer to a C-struct,
dataload = unsafe_load(data)
which in turn contains a field a which is a 2D array, a pointer to some
pointers of size 4, say.
julia> pointer_to_array(dataload.a,4)
Ptr{Node} @0x3b8f66c0
Ptr{Node} @0x3b8f66f0
Ptr{Node} @0x3b8f6750
Ptr{Node} @0x3b8f6810
Each pointer has an array of size 2. So this is a 4x2 2 dimensional array
julia> [pointer_to_array(L,2) for L in pointer_to_array(dataload.a,4)]
[Node(1,9.424044618506457),Node(2,11.88905969931336)]
[Node(1,9.678805056283334),Node(2,9.845676112951852)]
[Node(1,8.210282978159183),Node(2,11.911456933936952)]
[Node(1,11.916394646460297),Node(2,10.57806221488004)]
My problem is that the data the second pointers are pointing to seems to be
invisible to the garbage collector, and gets corrupted once in a while.
Turning off garbage collection seems to fix the problem, and forcing more
garbage collections increase the severity of it.
Is there an easy way to "tell" julia that I want this whole struct
untouched?
Thanks!
Gabe