Copy the Gemfile and test.rb into a directory.
Build jruby-openssl from master and run:
gem install pkg/jruby-openssl-0.9.17.dev-SNAPSHOT.gem
jruby -J-Xmx80m -J-XX:+HeapDumpOnOutOfMemoryError /path/to/test.rb
In my case, this OOMs and dumps a heap.
Now apply https://gist.github.com/bbrowning/759c7feff7f3d1d0d950b65bb12e10ed, rebuild jruby-openssl, and run:
gem install pkg/jruby-openssl-0.9.17.dev-SNAPSHOT.gem
jruby -J-Xmx80m -J-XX:+HeapDumpOnOutOfMemoryError /path/to/test.rb
After my changes this no longer OOMs.