I’d like to use DTrace on Leopard to do some profiling of a Ruby app
but I’m finding that any script that uses the “object-free” probe
eventually leads to a segfault.
For example, the script that Apple provides at:
/Developer/Examples/Ruby/DTrace/print_memory_usage.d
To reproduce:
-
In one Terminal fire up an instance of irb so that dtrace can find
the probes -
In another:
sudo dtrace -qs /Developer/Examples/Ruby/DTrace/print_memory_usage.d
- In another, run any sizeable Ruby script and watch the crashes
ensue.
For example:
won’t crash
ruby -e ‘1000.times{1+2}’
will crash
ruby -e ‘10000.times{1+2}’
will crash
irb
Here’s the console output for the irb crash:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
1.8/irb/extend-command.rb:93: [BUG] Segmentation fault
ruby 1.8.6 (2007-06-07) [universal-darwin9.0]
Abort trap
And here’s the stack trace:
Exception Type: EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_INVALID_ADDRESS at 0x000000007262694c
Crashed Thread: 0
Thread 0 Crashed:
0 libSystem.B.dylib 0x92d7f47a __kill + 10
1 libSystem.B.dylib 0x92df6782 raise + 26
2 libSystem.B.dylib 0x92e05d3f abort + 73
3 libruby.1.dylib 0x000cdcbc rb_exc_new + 0
4 libruby.1.dylib 0x001346f3 rb_gc_mark_trap_list +
508
5 libSystem.B.dylib 0x92d7d97b _sigtramp + 43
6 ??? 0xffffffff 0 + 4294967295
7 libruby.1.dylib 0x00144c08 rb_mod_class_variables +
634
8 libruby.1.dylib 0x00145680 rb_class_path + 31
9 libruby.1.dylib 0x001458a8 rb_obj_classname + 91
10 libruby.1.dylib 0x000eddbb rb_gc_mark_maybe + 1394
11 libruby.1.dylib 0x000ee493 rb_newobj + 28
12 libruby.1.dylib 0x0010af8f rb_node_newnode + 28
13 libruby.1.dylib 0x0011c881 ruby_yyparse + 53250
14 libruby.1.dylib 0x0011dda2 ruby_yyparse + 58659
15 libruby.1.dylib 0x00134271 ruby_process_options +
1148
16 libruby.1.dylib 0x000e69dd rb_load + 847
17 libruby.1.dylib 0x000e70a8 rb_require_safe + 1117
18 libruby.1.dylib 0x000da636 rb_eval_string_wrap +
17759
19 libruby.1.dylib 0x000db24a rb_eval_string_wrap +
20851
20 libruby.1.dylib 0x000d84c5 rb_eval_string_wrap +
9198
21 libruby.1.dylib 0x000e6a47 rb_load + 953
22 libruby.1.dylib 0x000e70a8 rb_require_safe + 1117
23 libruby.1.dylib 0x000da636 rb_eval_string_wrap +
17759
24 libruby.1.dylib 0x000db24a rb_eval_string_wrap +
20851
25 libruby.1.dylib 0x000d84c5 rb_eval_string_wrap +
9198
26 libruby.1.dylib 0x000e7388 rb_load_protect + 298
27 libruby.1.dylib 0x000e73b9 ruby_exec + 22
28 libruby.1.dylib 0x000e73e5 ruby_run + 42
29 ruby 0x00001fff 0x1000 + 4095
30 ruby 0x00001fa6 start + 54
Needless to say, I can’t run the application that I’d like to profile
either. The same crashes occur when trying to use the “object-free”
probe from inside Apple’s Instruments GUI.
Can anybody else repro this or is there something fishy with my
system?
Cheers,
Wincent