Skip to content

Commit

Permalink
Showing 3 changed files with 12 additions and 7 deletions.
3 changes: 3 additions & 0 deletions lib/rubinius/configuration.rb
Original file line number Diff line number Diff line change
@@ -14,6 +14,9 @@
s.vm_variable "young_initial_bytes", 3145728,
"The initial number of bytes the young generation of the GC should use"

s.vm_variable "young_max_bytes", 16 * 3145728,
"The maximum number of bytes the young generation of the GC should use"

s.vm_variable "young_autotune_size", true,
"Set whether or not the young GC should autotune the size"

15 changes: 8 additions & 7 deletions vm/objectmemory.cpp
Original file line number Diff line number Diff line change
@@ -58,6 +58,7 @@ namespace rubinius {
, code_manager_(&state->shared)
, mark_(2)
, allow_gc_(true)
, mature_mark_concurrent_(config.gc_immix_concurrent)
, mature_gc_in_progress_(false)
, slab_size_(4096)
, shared_(state->shared)
@@ -66,6 +67,11 @@ namespace rubinius {
, collect_mature_now(false)
, root_state_(state)
, last_object_id(1)
, last_snapshot_id(0)
, large_object_threshold(config.gc_large_object)
, young_max_bytes(config.gc_young_max_bytes * 2)
, young_autotune_factor(config.gc_young_autotune_factor)
, young_autotune_size(config.gc_young_autotune_size)
{
// TODO Not sure where this code should be...
#ifdef ENABLE_OBJECT_WATCH
@@ -75,16 +81,10 @@ namespace rubinius {
}
#endif

large_object_threshold = config.gc_large_object;
young_autotune_factor = config.gc_young_autotune_factor;
young_autotune_size = config.gc_young_autotune_size;

young_->set_lifetime(config.gc_young_lifetime);

if(config.gc_young_autotune_lifetime) young_->set_autotune_lifetime();

mature_mark_concurrent_ = config.gc_immix_concurrent;

for(size_t i = 0; i < LastObjectType; i++) {
type_info[i] = NULL;
}
@@ -669,7 +669,8 @@ namespace rubinius {
//
// If we don't see any young GC's we check if we should shrink it
if(young_gc_while_marking_ > 1) {
if(young_->bytes_size() < mature_bytes_allocated() / young_autotune_factor) {
if(young_->bytes_size() < young_max_bytes &&
young_->bytes_size() < mature_bytes_allocated() / young_autotune_factor) {
young_->grow(young_->bytes_size() * 2);
}
} else if(young_gc_while_marking_ == 0) {
1 change: 1 addition & 0 deletions vm/objectmemory.hpp
Original file line number Diff line number Diff line change
@@ -212,6 +212,7 @@ namespace rubinius {

/* Config variables */
size_t large_object_threshold;
size_t young_max_bytes;
int young_autotune_factor;
bool young_autotune_size;

0 comments on commit 215cc7a

Please sign in to comment.