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

x/mobile: Memory crash in iOS devices #28274

Open
C-ollins opened this Issue Oct 18, 2018 · 2 comments

Comments

Projects
None yet
4 participants
@C-ollins

C-ollins commented Oct 18, 2018

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.10.3 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="darwin"

What did you do?

key, err := scrypt.Key(password, salt, 262144, 8, 1, keyLen)
if err != nil {
    return
}

debug.FreeOSMemory()

What did you expect to see?

A successful run

What did you see instead?

A crash https://bpaste.net/show/308796b08e4c
Same code runs fine on android but happens to crash on iOS.

@gopherbot gopherbot added this to the Unreleased milestone Oct 18, 2018

@gopherbot gopherbot added the mobile label Oct 18, 2018

@timcooijmans

This comment has been minimized.

Contributor

timcooijmans commented Oct 19, 2018

The specified scrypt parameters require at least +/- 256 MiB of memory (See the excellent article of https://blog.filippo.io/the-scrypt-parameters/ @FiloSottile) , probably more due to overhead in the implementation and garbage-collection.

The iOS device you are using doesn't have this available and runs out of memory.

runtime: out of memory: cannot allocate 268435456-byte block (271581184 in use)
fatal error: out of memory
@C-ollins

This comment has been minimized.

C-ollins commented Oct 19, 2018

Why is this failing for iOS? I've tried it in an Android device with 1gb memory and it ran without errors. I tested with an iPhone 7 with 2gb ram and it fails every time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment