Skip to content

Instantly share code, notes, and snippets.

@axic
Created August 15, 2016 19:02
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 axic/d8ec3abfc91fef9298638f7e0f8cc730 to your computer and use it in GitHub Desktop.
Save axic/d8ec3abfc91fef9298638f7e0f8cc730 to your computer and use it in GitHub Desktop.
// (words * 3 + words ^ 2 / 512) - (allocated_words * 3 + allocated_words ^ 2 / 512)
var memsize = 1
var current = 0
while (true) {
var a = (memsize * 3) + (memsize ^ 2 / 512)
var b = ((memsize - 1) * 3) + ((memsize - 1) ^ 2 / 512)
current += (a - b)
memsize++
if (current > 4500000)
break
}
console.log(memsize, memsize * 32, current)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment