Skip to content

Instantly share code, notes, and snippets.

@stepheneb
Created July 31, 2010 17:39
Show Gist options
  • Save stepheneb/502415 to your computer and use it in GitHub Desktop.
Save stepheneb/502415 to your computer and use it in GitHub Desktop.

An example showing a jhat failure in the mlvm fork of Java 1.7 when used with the first example described here: Browsing Memory the JRuby Way.

I'm using JRuby 1.6.0.dev from from the tip of master.

$ jruby -v
jruby 1.6.0.dev (ruby 1.8.7 patchlevel 249) (2010-07-31 9771a2b) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_20) [x86_64-java]

There are no errors running the same tests using Java 1.6.0_20.

[jruby]$ java -version
openjdk version "1.7.0-internal-fastdebug"
OpenJDK Runtime Environment (build 1.7.0-internal-fastdebug-stephen_2010_07_30_11_56-b00)
OpenJDK Server VM (build 19.0-b03-fastdebug, mixed mode)
[jruby]$ cat foo_heap_example.rb
class Foo
end
ary = []
10000.times { ary << Foo.new }
puts "ready for analysis!"
sleep
[jruby]$ jruby foo_heap_example.rb
ready for analysis!
[dev]$ java -version
openjdk version "1.7.0-internal-fastdebug"
OpenJDK Runtime Environment (build 1.7.0-internal-fastdebug-stephen_2010_07_30_11_56-b00)
OpenJDK Server VM (build 19.0-b03-fastdebug, mixed mode)
[dev]$ which jmap
/usr/local/java-1.7.0/bin/jmap
[dev]$ jps -l
77647 sun.tools.jps.Jps
77567 org/jruby/Main
[dev]$ jmap -histo:live 77567
java.lang.NullPointerException
at java.io.File.<init>(File.java:293)
at sun.tools.attach.BsdVirtualMachine.findSocketFile(BsdVirtualMachine.java:252)
at sun.tools.attach.BsdVirtualMachine.<init>(BsdVirtualMachine.java:65)
at sun.tools.attach.BsdAttachProvider.attachVirtualMachine(BsdAttachProvider.java:63)
at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:213)
at sun.tools.jmap.JMap.attach(JMap.java:296)
at sun.tools.jmap.JMap.histo(JMap.java:218)
at sun.tools.jmap.JMap.main(JMap.java:138)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment