Skip to content

Instantly share code, notes, and snippets.

@binarycleric
Last active December 18, 2015 05:08
Show Gist options
  • Select an option

  • Save binarycleric/5730032 to your computer and use it in GitHub Desktop.

Select an option

Save binarycleric/5730032 to your computer and use it in GitHub Desktop.
ruby array esplosion!!!!!
>> array = {}; array[100000000000000000] = 1
=> 1
>> array = []; array[100000000000000000] = 1
irb(16739,0x7fff7de08960) malloc: *** mmap(size=800000000000004096) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
irb(16739,0x7fff7de08960) malloc: *** mmap(size=800000000000004096) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
NoMemoryError: failed to allocate memory
        from (irb):3:in `[]='
        from (irb):3
        from /Users/jon/.rvm/rubies/ruby-1.9.3-p392/bin/irb:16:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment