aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index b24f10c24..65f0a7938 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -316,13 +316,14 @@ void initGC()
(resident) memory to be allocated. This might be a problem on
systems that don't overcommit. */
if (!getEnv("GC_INITIAL_HEAP_SIZE")) {
- size_t size = 32 * 1024 * 1024;
+ int64_t size = 32 * 1024 * 1024;
#if HAVE_SYSCONF && defined(_SC_PAGESIZE) && defined(_SC_PHYS_PAGES)
- size_t maxSize = 384 * 1024 * 1024;
- long pageSize = sysconf(_SC_PAGESIZE);
- long pages = sysconf(_SC_PHYS_PAGES);
- if (pageSize != -1)
+ int64_t maxSize = 384 * 1024 * 1024;
+ int64_t pageSize = sysconf(_SC_PAGESIZE);
+ int64_t pages = sysconf(_SC_PHYS_PAGES);
+ if (pageSize != -1) {
size = (pageSize * pages) / 4; // 25% of RAM
+ }
if (size > maxSize) size = maxSize;
#endif
debug("setting initial heap size to %1% bytes", size);