From eb9ffff99b7505835c4f85ab250959bb7ef326df Mon Sep 17 00:00:00 2001 From: Nathan Zimmerberg <39104088+nhz2@users.noreply.github.com> Date: Fri, 2 Feb 2024 19:40:55 -0500 Subject: [PATCH] Add GC preserve before unsafe_copy! (#49) --- src/frame_compression.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/frame_compression.jl b/src/frame_compression.jl index c25813e..dbcb495 100644 --- a/src/frame_compression.jl +++ b/src/frame_compression.jl @@ -124,7 +124,7 @@ function TranscodingStreams.process(codec::LZ4FrameCompressor, input::Memory, ou return (data_read, data_written, :error) end data_written = sizeof(codec.header) - unsafe_copyto!(output.ptr, pointer(codec.header), data_written) + GC.@preserve codec unsafe_copyto!(output.ptr, pointer(codec.header), data_written) codec.write_header = false end