Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rshasum consumes a lot of RAM and crashes on large files #1

Open
shlomif opened this issue Apr 23, 2018 · 0 comments
Open

rshasum consumes a lot of RAM and crashes on large files #1

shlomif opened this issue Apr 23, 2018 · 0 comments

Comments

@shlomif
Copy link

shlomif commented Apr 23, 2018

Hi!

When running your program like this, go's RAM consumption balloons out of
control:

mkdir -p temp-zero
cat /dev/zero | head -c 4000000000 > temp-zero/zero.bin
go run ~/Download/unpack/file/rshasum/sum.go -a 512 temp-zero

Seems like you are reading the whole files into RAM . Note that sha checksums
can be calculated incrementally by using fixed size segments. This is the
approach taken by this quick bash script I wrote:

find . -type f -follow | (LC_ALL=C sort) | xargs -d '\n' sha256sum | tee >(a="`sha256sum -`"; sleep 0.05; echo "$a")

Please fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant