# Does eachline loads whole stream/file in memory?

**URL:** https://discourse.julialang.org/t/does-eachline-loads-whole-stream-file-in-memory/81602
**Category:** General Usage
**Created:** [May 24, 2022, 4:30pm UTC](https://discourse.julialang.org/t/does-eachline-loads-whole-stream-file-in-memory/81602 "2022-05-24T16:30:00Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Maxim\_Lubov](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maxim_lubov/32/29744_2.png) [@Maxim\_Lubov](https://discourse.julialang.org/u/Maxim_Lubov)
#### Post date: [May 24, 2022, 4:30pm UTC](https://discourse.julialang.org/t/does-eachline-loads-whole-stream-file-in-memory/81602/1 "2022-05-24T16:30:00Z")

</div>

My problem is following. I have a huge .csv file stored in S3 bucket. I don’t want to load it on disk, just read it line by line with the consecutive processing of each line. For the locally stored files I usually use `CSV.Rows` or `for row in CSV.file()`. However these options are unavailable in the case of S3 stored data. So, I use following approach:

```julia
open(s3path) do stream
        for line in eachline(stream)
            println(line)
        end
    end

```

My question is, does ```eachline load only one line into memory, so I could read huge .csv files without worrying about OOM problems?

---

<div class="post-metadata">

### Author: ![ericphanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ericphanson/32/215186_2.png) [@ericphanson](https://discourse.julialang.org/u/ericphanson)
#### Post date: [May 24, 2022, 5:27pm UTC](https://discourse.julialang.org/t/does-eachline-loads-whole-stream-file-in-memory/81602/2 "2022-05-24T17:27:12Z")

</div>

I think `eachline` doesn’t load more than it needs, but I think `open(f, ::S3Path)` **does** load the whole thing into memory, which is an issue with AWSS3: [Support for streaming `S3Path` data · Issue #204 · JuliaCloud/AWSS3.jl · GitHub](https://github.com/JuliaCloud/AWSS3.jl/issues/204).
