Closed mkitti closed 5 months ago
From what I can tell there are a lot of missing
GC.@preserve
inunsafe_transcode!
. Unless Julia automatically preserves all function inputs?
Currently, I think the GC.@preserve
might be implicit becuase input
and output
are used latter in the function. Also the flow control with @goto
may be difficult to optimize. However, a future optimization could do some kind of struct splitting, garbage collecting part of input
or output
in the future.
As far as I can tell, I think preserving the function input should be sufficient for the allocated memory to remain stable for the duration of the function call.
Add
GC.@preserve
when callingunsafe_transcode!
since buffer to memory conversions involve raw pointer conversions.