From 1119434d5f5eaafac126bf3eda14a3696f9241a6 Mon Sep 17 00:00:00 2001 From: Nathan Zimmerberg <39104088+nhz2@users.noreply.github.com> Date: Fri, 2 Feb 2024 12:31:36 -0500 Subject: [PATCH] Add GC preserve before unsafe_copy! --- 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