Skip to content

Instantly share code, notes, and snippets.

@jmettraux
Created February 16, 2009 06:59
Show Gist options
  • Select an option

  • Save jmettraux/65061 to your computer and use it in GitHub Desktop.

Select an option

Save jmettraux/65061 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'ffi'
module Hello
extend FFI::Library
attach_function 'puts', [ :string ], :int
end
Hello.puts("hello a")
Hello.send(:puts, "hello b")
# jmettraux:~/tmp/ffi$ ruby stack_level_too_deep.rb
# hello a
# hello b
# jmettraux:~/tmp/ffi$ ruby19 stack_level_too_deep.rb
# hello a
# hello b
# jmettraux:~/tmp/ffi$ jruby-1.1.6 stack_level_too_deep.rb
# hello a
# Error: Your application used more stack memory than the safety cap of 1024k.
# Specify -J-Xss####k to increase it (#### = cap size in KB).
# Specify -w for full StackOverflowError stack trace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment