-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault in OCaml gc #103
Comments
The problem is that open! Core
let () =
Py.initialize ();
let m =
Py.Import.exec_code_module_from_string
~name:"go.py"
"import numpy as np\na = np.array([[1, 2, 3], [4, 5, 6]], dtype=np.float32)"
in
let big_array = Py.Module.get m "a" |> Numpy.to_bigarray Float32 C_layout in
let arr = List.init 10 ~f:(Fn.const big_array) in
List.iter arr ~f:Owl.Dense.Ndarray.S.print;
Gc.full_major ()
,;; will cause |
Ahah, in #98 mentions that slicing is bugged, which makes sense. |
I'm not sure how to fix this. It seems like we need to do some ref counting in the finalizer unless we know that the subarrays are dead when the original array is finalized. From skimming |
The folllowing code will segfault on my system.
Python 3.11.4
Ocaml 5.1.1
pyml 20231101
It dies in the OCaml garbage collector:
It might be related to this issue given that both code examples use
Numpy.to_bigarray
.The text was updated successfully, but these errors were encountered: