Skip to content

Commit

Permalink
Some fixes around ensuring referenced data doesn't get cleaned up.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnuernber committed Mar 1, 2021
1 parent 55e0518 commit 7ba29c4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/tech/v3/datatype/ffi.clj
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ user> dbuf
(->pointer [item] item)
NativeBuffer
(convertible-to-pointer? [item] true)
(->pointer [item] (Pointer. (.address item))))
;;Keep a reference to the native buffer so that it doesn't get GC'd while
;;this pointer is in scope.
(->pointer [item] (Pointer. (.address item) {:src-buffer item})))


(defn instantiate-class
Expand Down
2 changes: 1 addition & 1 deletion src/tech/v3/datatype/native_buffer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
(NativeBuffer. address n-elems datatype endianness resource-type
metadata
cached-io
parent))
item))
Counted
(count [item] (int (dtype-proto/ecount item)))
Indexed
Expand Down

0 comments on commit 7ba29c4

Please sign in to comment.