I've also tried to read a large file using the approach above and faced the same issues with memory consumption. My implementation is similar to that one.
autoreleasepool did't solve the issues.
It appears the new async/await API consumes the same large amounts of memory
let reader = try FileHandle(forReadingFrom: url)
for try await line in reader.bytes.lines {
// some code processing `line`
}
Topic:
Programming Languages
SubTopic:
Swift
Tags: