File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -453,6 +453,14 @@ proc fileInput*(filename: string,
453453 return fileInput (file, offset, pageSize)
454454
455455func unsafeMemoryInput * (mem: openArray [byte ]): InputStreamHandle =
456+ # # Unsafe memory input that relies on `mem` to remain available for the
457+ # # duration of the usage of the input stream.
458+ # #
459+ # # One particular high-risk scenario is when using `--mm:refc` - when `mem`
460+ # # refers to a local garbage-collected type like `seq`, the GC might claim
461+ # # the instance even though scope-wise, it looks like it should stay alive.
462+ # #
463+ # # See also https://github.com/nim-lang/Nim/issues/25080
456464 let head = cast [ptr byte ](mem)
457465
458466 makeHandle InputStream (
You can’t perform that action at this time.
0 commit comments