From f6ac9d25712d017e1446cf9b292e63d46ee72815 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Thu, 10 Mar 2022 16:47:52 +0100 Subject: [PATCH] Ability to set heap size on command line --- GCBench.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/GCBench.c b/GCBench.c index 903713d3c..f00f71016 100644 --- a/GCBench.c +++ b/GCBench.c @@ -230,6 +230,13 @@ int main() { double kHeapMultiplier = 3; size_t kHeapSize = kHeapMaxLive * kHeapMultiplier; + if (getenv("HEAP_SIZE")) + kHeapSize = atol(getenv("HEAP_SIZE")); + if (!kHeapSize) { + fprintf(stderr, "Failed to parse HEAP_SIZE='%s'\n", getenv("HEAP_SIZE")); + return 1; + } + struct context _cx; struct context *cx = &_cx; initialize_gc(cx, kHeapSize);