From 4e62666749c2df57e7c22498f15f6a73f3541732 Mon Sep 17 00:00:00 2001 From: Cris Stringfellow <22254235+crislin2046@users.noreply.github.com> Date: Thu, 3 Mar 2022 12:03:47 +0800 Subject: [PATCH] "Memory" --- package.json | 2 +- run.sh | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100755 run.sh diff --git a/package.json b/package.json index ec153cb..65fc5d9 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ }, "scripts": { "bundle": "npx rollup --config", - "start": "node src/app.js", + "start": "bash ./run.sh", "setup": "bash ./scripts/build_setup.sh", "build": "echo 'please run ./scripts/build_setup.sh first (one time only) and then ./scripts/compile.sh'", "clean": "rm -rf build/* bin/*", diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..14c31a4 --- /dev/null +++ b/run.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +phys=$(free -t -m | grep -oP '\d+' | sed '10!d') +alloc=$(echo "$phys * 90/100" | bc ) +echo $alloc +node --max-old-space-size=$alloc src/app.js