aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/ZigGlobalObject.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-26 19:07:25 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-06-26 19:07:54 -0700
commit4be15cff026eed36762b955003ce805a59d8f6a7 (patch)
treef64a51bddc03f4634898f814267a0dc476900f88 /src/bun.js/bindings/ZigGlobalObject.cpp
parentf839cf1ce309959f168066e51edc2e8b0038728e (diff)
downloadbun-4be15cff026eed36762b955003ce805a59d8f6a7.tar.gz
bun-4be15cff026eed36762b955003ce805a59d8f6a7.tar.zst
bun-4be15cff026eed36762b955003ce805a59d8f6a7.zip
Tweak the ramSize setting because /= 1024 is causing CI to fail on arm64 when there's only 8 GB of ram
Diffstat (limited to '')
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp
index 38d5fb1d6..b27e0aafc 100644
--- a/src/bun.js/bindings/ZigGlobalObject.cpp
+++ b/src/bun.js/bindings/ZigGlobalObject.cpp
@@ -280,7 +280,13 @@ extern "C" void JSCInitialize(const char* envp[], size_t envc, void (*onCrash)(c
// crypto.createHash("sha1") 985.26 ns/iter (956.7 ns … 1.12 µs) 1 µs 1.12 µs 1.12 µs
// Peak memory usage: 56 MB
size_t ramSize = WTF::ramSize();
- ramSize /= 1024;
+
+ // We originally went with a hardcoded /= 1024 here
+ // But if you don't have much memory, that becomes a problem.
+ // Instead, we do 65%
+ double ramSizeDouble = static_cast<double>(ramSize);
+ ramSizeDouble *= 0.65;
+ ramSize = static_cast<size_t>(ramSizeDouble);
if (ramSize > 0) {
JSC::Options::forceRAMSize() = ramSize;