# Skipping a lot of lines in CSV.read() allocates too much memory

**URL:** https://discourse.julialang.org/t/skipping-a-lot-of-lines-in-csv-read-allocates-too-much-memory/110121
**Category:** Performance
**Tags:** csv, io
**Created:** [February 12, 2024, 9:52pm UTC](https://discourse.julialang.org/t/skipping-a-lot-of-lines-in-csv-read-allocates-too-much-memory/110121 "2024-02-12T21:52:47Z")
**Posts on this page:** 1
**Showing post:** 77

<div class="post-metadata">

### Author: ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)
#### Post date: [February 22, 2024, 9:25am UTC](https://discourse.julialang.org/t/skipping-a-lot-of-lines-in-csv-read-allocates-too-much-memory/110121/77 "2024-02-22T09:25:52Z")

</div>

> [@rocco\_sprmnt21](#):
>
> Why is mmap() so much faster than read() and seek()

I used mmap after reading this post

> [@File IO Buffers too small?](https://discourse.julialang.org/t/file-io-buffers-too-small/89931/2):
>
> You can use [GitHub - JuliaIO/BufferedStreams.jl: Fast composable IO streams](https://github.com/JuliaIO/BufferedStreams.jl). But indeed, I have also found the performance of IOStream to be unacceptable for many IO tasks where you typically read many small values. One issue with IOStream is that it takes a lock on every IO operation in order to be thread-safe. For binary files, I typically resort to memory mapping the file and wrapping it in an IOBuffer. So instead of io = open("some very large file.dat") I do using Mmap io = IOBuffer(M…

---

_[View the full topic](https://discourse.julialang.org/t/skipping-a-lot-of-lines-in-csv-read-allocates-too-much-memory/110121)._
