Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
rvm-patchsets/patches/ruby/1.9.3/p392/railsexpress/05-track-live-dataset-size.patch
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
45 lines (41 sloc)
1.28 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/gc.c b/gc.c | |
index 7f65b98..8498fe4 100644 | |
--- a/gc.c | |
+++ b/gc.c | |
@@ -281,7 +281,6 @@ getrusage_time(void) | |
#define GC_PROF_DEC_LIVE_NUM | |
#endif | |
- | |
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CYGWIN__) | |
#pragma pack(push, 1) /* magic for reducing sizeof(RVALUE): 24 -> 20 */ | |
#endif | |
@@ -1562,6 +1561,24 @@ rb_gc_time() | |
#endif | |
} | |
+/* | |
+ * call-seq: | |
+ * GC.heap_slots_live_after_last_gc => Integer | |
+ * | |
+ * Returns the number of heap slots which were live after the last garbage collection. | |
+ * | |
+ * GC.heap_slots_live_after_last_gc #=> 231223 | |
+ * | |
+ */ | |
+VALUE | |
+rb_gc_heap_slots_live_after_last_gc() | |
+{ | |
+ rb_objspace_t *objspace = &rb_objspace; | |
+ return ULONG2NUM(live_after_last_mark_phase); | |
+} | |
+ | |
+ | |
+ | |
VALUE rb_mGC; | |
void | |
@@ -4533,6 +4550,7 @@ Init_GC(void) | |
rb_define_singleton_method(rb_mGC, "allocated_size", rb_gc_allocated_size, 0); | |
rb_define_singleton_method(rb_mGC, "num_allocations", rb_gc_num_allocations, 0); | |
rb_define_singleton_method(rb_mGC, "heap_slots", rb_gc_heap_slots, 0); | |
+ rb_define_singleton_method(rb_mGC, "heap_slots_live_after_last_gc", rb_gc_heap_slots_live_after_last_gc, 0); | |
rb_define_const(rb_mGC, "HEAP_SLOT_SIZE", INT2FIX(sizeof(RVALUE))); | |
rb_define_singleton_method(rb_mGC, "log", rb_gc_log, 1); |