fix(script): Update set_node_mem.sh to work in MacOS (#405)

This commit is contained in:
Parth Agarwal authored and GitHub committed 2026-06-25 08:31:40 +02:00
1 parent 9ff69dc69f
commit 0889c1324f
1 file changed
+14 -5
+14 -5
View File
@@ -1,5 +1,14 @@
memory=$(awk '/MemTotal/{print $2}' /proc/meminfo);
memory=$((memory / 1024));
node_options="--max-old-space-size=$((memory - 1024))";
echo "NODE_OPTIONS=$node_options";
export NODE_OPTIONS="$node_options";
#!/bin/bash
if [[ "$OSTYPE" == "darwin"* ]]; then
memory=$(sysctl -n hw.memsize)
memory=$((memory / 1024 / 1024))
else
memory=$(awk '/MemTotal/{print $2}' /proc/meminfo)
memory=$((memory / 1024))
fi
node_options="--max-old-space-size=$((memory - 1024))"
echo "NODE_OPTIONS=$node_options"
export NODE_OPTIONS="$node_options"