The Wayback Machine - https://web.archive.org/web/20201127090547/https://github.com/Kotlin/kotlin-examples/issues/122
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

Creating a primitive array produce OutOfMemoryError #122

Open
jmetertea opened this issue Dec 30, 2019 · 0 comments
Open

Creating a primitive array produce OutOfMemoryError #122

jmetertea opened this issue Dec 30, 2019 · 0 comments

Comments

@jmetertea
Copy link

@jmetertea jmetertea commented Dec 30, 2019

When creating a primitive array with big size as:

CharArray(99912345)

It produces Exception:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Creates a new array of the specified size, with all elements initialized to null char (`\u0000').

Similar code in Java won't produce an exception:

char[]a = new char[99912345];

Same issue for other primitive arrays, as BooleanArray
BooleanArray(99912345)
Checked with Kotlin Playground

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant
You can’t perform that action at this time.