heap_dump 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/heap_dump/heap_dump.c +56 -11
- data/lib/heap_dump/version.rb +1 -1
- metadata +7 -7
data/ext/heap_dump/heap_dump.c
CHANGED
|
@@ -520,6 +520,32 @@ static void dump_iseq(const rb_iseq_t* iseq, walk_ctx_t *ctx){
|
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
+
static void dump_block(const rb_block_t* block, walk_ctx_t *ctx){
|
|
524
|
+
// VALUE self; /* share with method frame if it's only block */
|
|
525
|
+
// VALUE *lfp; /* share with method frame if it's only block */
|
|
526
|
+
// VALUE *dfp; /* share with method frame if it's only block */
|
|
527
|
+
// rb_iseq_t *iseq;
|
|
528
|
+
// VALUE proc;
|
|
529
|
+
|
|
530
|
+
if(block->iseq && !RUBY_VM_IFUNC_P(block->iseq)) {
|
|
531
|
+
yg_cstring("iseq");
|
|
532
|
+
yajl_gen_map_open(ctx->yajl);
|
|
533
|
+
//FIXME: id may be different (due to RBasic fields)!!!
|
|
534
|
+
ygh_id("id", block->iseq);
|
|
535
|
+
dump_iseq(block->iseq, ctx);
|
|
536
|
+
yajl_gen_map_close(ctx->yajl);
|
|
537
|
+
} else {
|
|
538
|
+
ygh_id("iseq", block->iseq);
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
ygh_id("self", block->self);
|
|
542
|
+
|
|
543
|
+
ygh_id("lfp", block->lfp);
|
|
544
|
+
ygh_id("dfp", block->dfp);
|
|
545
|
+
//lfp = local frame pointer? local_num elems?
|
|
546
|
+
// dfp = ?
|
|
547
|
+
}
|
|
548
|
+
|
|
523
549
|
|
|
524
550
|
static void dump_data_if_known(VALUE obj, walk_ctx_t *ctx){
|
|
525
551
|
|
|
@@ -535,6 +561,8 @@ static void dump_data_if_known(VALUE obj, walk_ctx_t *ctx){
|
|
|
535
561
|
// proc <-
|
|
536
562
|
// thgroup
|
|
537
563
|
// time
|
|
564
|
+
// barrier
|
|
565
|
+
// strio
|
|
538
566
|
// etc...
|
|
539
567
|
|
|
540
568
|
const char* typename = RTYPEDDATA_TYPE(obj)->wrap_struct_name;
|
|
@@ -545,6 +573,20 @@ static void dump_data_if_known(VALUE obj, walk_ctx_t *ctx){
|
|
|
545
573
|
return;
|
|
546
574
|
}
|
|
547
575
|
|
|
576
|
+
if(!strcmp("autoload", typename)){
|
|
577
|
+
const st_table *tbl = RTYPEDDATA_DATA(obj);
|
|
578
|
+
yg_cstring("val");
|
|
579
|
+
yajl_gen_map_open(ctx->yajl);
|
|
580
|
+
st_foreach(tbl, dump_method_entry_i, (st_data_t)ctx);
|
|
581
|
+
yajl_gen_map_close(ctx->yajl);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
if(!strcmp("barrier", typename)){
|
|
586
|
+
ygh_id("val", (VALUE)RTYPEDDATA_DATA(obj));
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
|
|
548
590
|
if(!strcmp("proc", typename)){
|
|
549
591
|
const rb_proc_t *proc = RTYPEDDATA_DATA(obj);
|
|
550
592
|
ygh_int("is_lambda", proc->is_lambda);
|
|
@@ -553,16 +595,10 @@ static void dump_data_if_known(VALUE obj, walk_ctx_t *ctx){
|
|
|
553
595
|
//TODO: dump refs from env here (they're dumped in env itself, but just to make analysis easier)?
|
|
554
596
|
|
|
555
597
|
//TODO: is this proc->block.iseq sometimes bound somewhere (seems to be not, but dupes exist)
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
ygh_id("id", proc->block.iseq);
|
|
561
|
-
dump_iseq(proc->block.iseq, ctx);
|
|
562
|
-
yajl_gen_map_close(ctx->yajl);
|
|
563
|
-
} else {
|
|
564
|
-
ygh_id("iseq", proc->block.iseq);
|
|
565
|
-
}
|
|
598
|
+
yg_cstring("block");
|
|
599
|
+
yajl_gen_map_open(ctx->yajl);
|
|
600
|
+
dump_block(&proc->block, ctx);
|
|
601
|
+
yajl_gen_map_close(ctx->yajl);
|
|
566
602
|
return;
|
|
567
603
|
}
|
|
568
604
|
|
|
@@ -596,11 +632,19 @@ static void dump_data_if_known(VALUE obj, walk_ctx_t *ctx){
|
|
|
596
632
|
if(!strcmp("VM/env", typename)){
|
|
597
633
|
const rb_env_t* env = RTYPEDDATA_DATA(obj);
|
|
598
634
|
int i = 0;
|
|
599
|
-
yg_cstring("
|
|
635
|
+
yg_cstring("env");
|
|
600
636
|
yajl_gen_array_open(ctx->yajl);
|
|
601
637
|
for(; i < env->env_size; i++)
|
|
602
638
|
yg_id(env->env[i]);
|
|
603
639
|
yajl_gen_array_close(ctx->yajl);
|
|
640
|
+
|
|
641
|
+
ygh_int("local_size", env->local_size);
|
|
642
|
+
ygh_id("prev_envval", env->prev_envval);
|
|
643
|
+
|
|
644
|
+
yg_cstring("block");
|
|
645
|
+
yajl_gen_map_open(ctx->yajl);
|
|
646
|
+
dump_block(&env->block, ctx);
|
|
647
|
+
yajl_gen_map_close(ctx->yajl);
|
|
604
648
|
return;
|
|
605
649
|
}
|
|
606
650
|
|
|
@@ -608,6 +652,7 @@ static void dump_data_if_known(VALUE obj, walk_ctx_t *ctx){
|
|
|
608
652
|
const rb_vm_t *vm = RTYPEDDATA_DATA(obj);
|
|
609
653
|
|
|
610
654
|
ygh_id("thgroup_default", vm->thgroup_default);
|
|
655
|
+
// rb_gc_register_mark_object - goes in that array (not to be freed until vm dies)
|
|
611
656
|
ygh_id("mark_object_ary", vm->mark_object_ary);
|
|
612
657
|
ygh_id("load_path", vm->load_path);
|
|
613
658
|
ygh_id("loaded_features", vm->loaded_features);
|
data/lib/heap_dump/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: heap_dump
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.12
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -13,7 +13,7 @@ date: 2012-06-01 00:00:00.000000000Z
|
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: ruby-internal
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70353553846140 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: 0.8.5
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70353553846140
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: yajl-ruby
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &70353553845660 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ~>
|
|
@@ -32,10 +32,10 @@ dependencies:
|
|
|
32
32
|
version: '1.1'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *70353553845660
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: rake-compiler
|
|
38
|
-
requirement: &
|
|
38
|
+
requirement: &70353553845240 !ruby/object:Gem::Requirement
|
|
39
39
|
none: false
|
|
40
40
|
requirements:
|
|
41
41
|
- - ! '>='
|
|
@@ -43,7 +43,7 @@ dependencies:
|
|
|
43
43
|
version: '0'
|
|
44
44
|
type: :development
|
|
45
45
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *70353553845240
|
|
47
47
|
description: dump ruby 1.9 heap contents
|
|
48
48
|
email:
|
|
49
49
|
- vasilyfedoseyev@gmail.com
|