Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Create large string
require 'fiddle'
def create_large_string(size)
func =['rb_str_new'], [Fiddle::TYPE_VOIDP,Fiddle::TYPE_LONG], Fiddle::TYPE_VOIDP)
# returns fast on environments whose malloc delays the actual allocation
ptr =, size)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.