Skip to content

Commit c126b5e

Browse files
committed
Next try
1 parent 853c9b1 commit c126b5e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

bin/create_sys_image

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,17 @@ else
8787
exit 1
8888
fi
8989

90-
# Check memory only on Linux (not available on Windows)
91-
if [[ "$OSTYPE" != "msys" && "$OSTYPE" != "win32" ]]; then
90+
# Check memory and limit threads if needed
91+
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
92+
# Windows: use wmic or PowerShell
93+
export JULIA_IMAGE_THREADS=4
94+
totalmem=$(powershell.exe -Command "(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1MB" 2>/dev/null | awk '{printf "%i", $1}')
95+
if [[ -z "$totalmem" || $totalmem -lt 27000 ]]; then
96+
echo "Warning: Less than 27GB of memory detected on Windows. Using only one thread for sysimage compilation."
97+
export JULIA_IMAGE_THREADS=1
98+
fi
99+
else
100+
# Linux: use /proc/meminfo
92101
totalmem=$(grep MemTotal /proc/meminfo | awk '{printf "%i", $2 / 1024}')
93102
if [[ $totalmem -lt 27000 ]]; then
94103
echo "Warning: Less than 27GB of memory detected. Using only one thread for sysimage compilation."

0 commit comments

Comments
 (0)