Hacker News new | ask | show | jobs
by Thaxll 1731 days ago
It's a question I ask often in interview, how do you upload a 5GB file over the network with only 1MB of memory.
5 comments

I am even not sure what this question is aiming at - I hope you are phrasing it more detailed than put here, or it would fit in those posts about the problems with interview questions :).

Assuming the file is on a disk and the 1 MB refers to the system memory - like you do with any potentially unbound data, you read and write it in chunks. Reading in data of any kind in whole is only reasonable, if you can clearly set an upper bound for its size.

This is not vague, it aims to see if the candidate has a notion of buffering, streaming ect ... the numbers don't really matter, you would be surprised at how many candidate have no idea how to load data in memory.
> with only 1MB of memory

Is that total system memory?

Well I left Kentucky back in '49 and went to Detroit work'n on assembly line..
To such a vague question, the only answer can be "less than 1MB at a time". Not terribly useful.
hello world in Go is 1.9 MB
I am not saying it's bad given what go runtime can do