Skip to content

Instantly share code, notes, and snippets.

@danielsiwiec
Last active November 15, 2022 02:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielsiwiec/56d20658fcb50d6e08f38a3e35ede180 to your computer and use it in GitHub Desktop.
Save danielsiwiec/56d20658fcb50d6e08f38a3e35ede180 to your computer and use it in GitHub Desktop.
heap killer
val list = mutableListOf<ByteArray>()
generateSequence(0) { it + 1 }.forEach {
if (it % (HEAP_TO_FILL / INCREMENTS_IN_MB) == 0) list.clear()
list.add(ByteArray(INCREMENTS_IN_MB * BYTES_TO_MB))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment