Skip to content

Instantly share code, notes, and snippets.

@dogbert17
Created February 9, 2017 22:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogbert17/8e0061b91ab7dcca60339fd6f663a5ed to your computer and use it in GitHub Desktop.
Save dogbert17/8e0061b91ab7dcca60339fd6f663a5ed to your computer and use it in GitHub Desktop.
orchestrate.diff
diff --git a/src/gc/orchestrate.c b/src/gc/orchestrate.c
index 6309a8a7..5f99ff69 100644
--- a/src/gc/orchestrate.c
+++ b/src/gc/orchestrate.c
@@ -286,11 +286,11 @@ MVMint32 MVM_gc_is_thread_blocked(MVMThreadContext *tc) {
}
static MVMint32 is_full_collection(MVMThreadContext *tc) {
- MVMuint64 percent_growth;
- size_t rss, promoted;
+ MVMuint64 percent_growth, promoted;
+ size_t rss;
/* If it's below the absolute minimum, quickly return. */
- promoted = (size_t)MVM_load(&tc->instance->gc_promoted_bytes_since_last_full);
+ promoted = (MVMuint64)MVM_load(&tc->instance->gc_promoted_bytes_since_last_full);
if (promoted < MVM_GC_GEN2_THRESHOLD_MINIMUM)
return 0;
@@ -302,7 +302,8 @@ static MVMint32 is_full_collection(MVMThreadContext *tc) {
/* Otherwise, consider percentage of resident set size. */
if (uv_resident_set_memory(&rss) < 0 || rss == 0)
rss = 50 * 1024 * 1024;
- percent_growth = (100 * promoted) / rss;
+ percent_growth = (100 * promoted) / (MVMuint64)rss;
+
return percent_growth >= MVM_GC_GEN2_THRESHOLD_PERCENT;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment