Feature #1047 » patch-1.9.2-gc-methods.patch
| gc.c | ||
|---|---|---|
| } | ||
| /* | ||
| * call-seq: | ||
| * GC.malloc_limit -> Integer | ||
| * | ||
| * The size of the malloc limit (minimum heap size). | ||
| * | ||
| * It returns the bare minimum size of the heap. | ||
| */ | ||
| | ||
| static VALUE | ||
| gc_malloc_limit_get(VALUE self) | ||
| { | ||
| rb_objspace_t *objspace = &rb_objspace; | ||
| return UINT2NUM(malloc_limit); | ||
| } | ||
| /* | ||
| * | ||
| * call-seq: | ||
| * GC.malloc_limit = integer -> Integer | ||
| * | ||
| * Updates the size of the malloc limit (minimum heap size). | ||
| * | ||
| * It returns the new bare minimum size of the heap. | ||
| */ | ||
| | ||
| static VALUE | ||
| gc_malloc_limit_set(VALUE self, VALUE new_limit) | ||
| { | ||
| rb_objspace_t *objspace = &rb_objspace; | ||
| malloc_limit = initial_malloc_limit = NUM2UINT(new_limit); | ||
| return new_limit; | ||
| } | ||
| /* | ||
| * call-seq: | ||
| * GC.heap_min_slots -> Integer | ||
| * | ||
| * The minimum number of slots in each heap slab. | ||
| * | ||
| * It returns the number of slots to allocate for each heap slab. | ||
| */ | ||
| | ||
| static VALUE | ||
| gc_heap_min_slots_get(VALUE self) | ||
| { | ||
| return UINT2NUM(initial_heap_min_slots); | ||
| } | ||
| /* | ||
| * | ||
| * call-seq: | ||
| * GC.heap_min_slots = integer -> Integer | ||
| * | ||
| * Updates the minimum number of slots in each heap slab. | ||
| * | ||
| * It returns the new number of slots to allocate for each heap slab. | ||
| */ | ||
| | ||
| static VALUE | ||
| gc_heap_min_slots_set(VALUE self, VALUE new_num_slots) | ||
| { | ||
| initial_heap_min_slots = NUM2UINT(new_num_slots); | ||
| return new_num_slots; | ||
| } | ||
| /* | ||
| * call-seq: | ||
| * GC.free_min -> Integer | ||
| * | ||
| * The minimum number of free slots after gc. | ||
| * | ||
| * It returns minimum number of free slots after garbage collection | ||
| * which do not lead to allocation of new heaps | ||
| */ | ||
| static VALUE | ||
| gc_free_min_get(VALUE self) | ||
| { | ||
| return UINT2NUM(initial_free_min); | ||
| } | ||
| /* | ||
| * call-seq: | ||
| * GC.free_min = integer -> Integer | ||
| * | ||
| * Updates the minimum number of free slots. | ||
| * | ||
| * It return the new minimum number of free slots. | ||
| */ | ||
| static VALUE | ||
| gc_free_min_set(VALUE self, VALUE new_free_min) | ||
| { | ||
| initial_free_min = NUM2UINT(new_free_min); | ||
| return new_free_min; | ||
| } | ||
| /* | ||
| * The <code>GC</code> module provides an interface to Ruby's mark and | ||
| * sweep garbage collection mechanism. Some of the underlying methods | ||
| * are also available via the <code>ObjectSpace</code> module. | ||
| ... | ... | |
| rb_define_singleton_method(rb_mGC, "stress", gc_stress_get, 0); | ||
| rb_define_singleton_method(rb_mGC, "stress=", gc_stress_set, 1); | ||
| rb_define_singleton_method(rb_mGC, "count", gc_count, 0); | ||
| rb_define_singleton_method(rb_mGC, "malloc_limit", gc_malloc_limit_get, 0); | ||
| rb_define_singleton_method(rb_mGC, "malloc_limit=", gc_malloc_limit_set, 1); | ||
| rb_define_singleton_method(rb_mGC, "heap_min_slots", gc_heap_min_slots_get, 0); | ||
| rb_define_singleton_method(rb_mGC, "heap_min_slots=", gc_heap_min_slots_set, 1); | ||
| rb_define_singleton_method(rb_mGC, "free_min", gc_free_min_get, 0); | ||
| rb_define_singleton_method(rb_mGC, "free_min=", gc_free_min_set, 1); | ||
| rb_define_method(rb_mGC, "garbage_collect", rb_gc_start, 0); | ||
| rb_mProfiler = rb_define_module_under(rb_mGC, "Profiler"); | ||
- « Previous
- 1
- …
- 3
- 4
- 5
- Next »