From 13005eec86c40d8a2d804b4fe41b2fdded3aae22 Mon Sep 17 00:00:00 2001 From: Ryan Macnak Date: Tue, 13 Aug 2019 21:36:14 +0000 Subject: [PATCH] [vm] Limit heap size to 15GB on 64-bit systems to avoid fatal errors on page table exhaustion. Compare 2d22b6ee6bf8334e085235d8a1eac532137ecff0. Change-Id: I67c25030fca1aca144d6affb3108f10d20de5b6f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99092 Reviewed-by: Siva Annamalai Commit-Queue: Ryan Macnak --- runtime/vm/globals.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/vm/globals.h b/runtime/vm/globals.h index 682ee906552..aa436e1732f 100644 --- a/runtime/vm/globals.h +++ b/runtime/vm/globals.h @@ -36,7 +36,11 @@ const intptr_t kSmiMin32 = -(static_cast(1) << kSmiBits32); const intptr_t kBytesPerBigIntDigit = 4; // The default old gen heap size in MB, where 0 == unlimited. -const intptr_t kDefaultMaxOldGenHeapSize = (kWordSize <= 4) ? 1536 : 0; +// 32-bit: OS limit is 2 or 3 GB +// 64-bit: OS limit is 2^16 page table entries * 256 KB HeapPages = 16 GB +// Set the VM limit below the OS limit to increase the likelihood of failing +// gracefully with a Dart OutOfMemory exception instead of SIGABORT. +const intptr_t kDefaultMaxOldGenHeapSize = (kWordSize <= 4) ? 1536 : 15360; #define kPosInfinity bit_cast(DART_UINT64_C(0x7ff0000000000000)) #define kNegInfinity bit_cast(DART_UINT64_C(0xfff0000000000000))