Skip to content

Discussing reader behaviour when they shared the same File Descriptor #347

Answered by BurntSushi
LangArthur asked this question in Q&A
Discussion options

You must be logged in to vote

I imagine it caches the content of the file

Why? What would happen if you asked the csv library to parse a 40GB CSV file on a machine with only 8GB of memory?

The entire design of this library is quite intentional about the fact that you only ever need to hold a single record in memory at any given point in time. (And if you drop down to csv-core, you don't actually need any heap memory at all!)

I feel like this probably answers the rest of your question, right? The csv::Reader just takes an std::io::Read and reads from it. If you want the underlying reader to do other things, you gotta do that yourself explicitly. Or just re-open the file. The csv::Reader API also provides seek methods…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by LangArthur
Comment options

You must be logged in to vote
5 replies
@BurntSushi
Comment options

@LangArthur
Comment options

@BurntSushi
Comment options

@LangArthur
Comment options

@BurntSushi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants