Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Make GC less aggressive for big heaps

  • Loading branch information...
piscisaureus committed May 4, 2012
1 parent 992e346 commit 92afcaa524859b28e0ba659555369c380840acbb
Showing with 14 additions and 8 deletions.
  1. +14 −8 src/node.cc
@@ -183,10 +183,10 @@ static void StopGCTimer () {
static void Idle(uv_idle_t* watcher, int status) {
assert((uv_idle_t*) watcher == &gc_idle);

if (V8::IdleNotification()) {
uv_idle_stop(&gc_idle);
StopGCTimer();
}
V8::IdleNotification();

uv_idle_stop(&gc_idle);
StopGCTimer();
}


@@ -1415,10 +1415,16 @@ static void CheckStatus(uv_timer_t* watcher, int status) {
if (!uv_is_active((uv_handle_t*) &gc_idle)) {
HeapStatistics stats;
V8::GetHeapStatistics(&stats);
if (stats.total_heap_size() > 1024 * 1024 * 128) {
// larger than 128 megs, just start the idle watcher
uv_idle_start(&gc_idle, node::Idle);
return;
uint64_t heap_size = stats.total_heap_size();
if (heap_size > 1024 * 1024 * 128);
uint64_t heap_used = stats.used_heap_size();
uint64_t heap_used_percent = (heap_used * 100) / heap_size;
if (heap_used_percent > 75) {
// larger than 128 megs and more than 75% full, just start the idle
// watcher
uv_idle_start(&gc_idle, node::Idle);
return;
}
}
}

0 comments on commit 92afcaa

Please sign in to comment.
You can’t perform that action at this time.