core: 查询不到准确内存时使用 free 兜底

fixes #179
This commit is contained in:
bin456789 2024-10-19 00:42:30 +08:00
parent a45aa86b7d
commit 6408fa85f1
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -1730,6 +1730,12 @@ check_ram() {
fi
fi
# 用于兜底,不太准确
if [ -z $ram_size ]; then
ram_size=$(free -m | grep ^Mem: | awk '{print $2}')
ram_size=$((ram_size + 64 + 4))
fi
if [ -z $ram_size ] || [ $ram_size -le 0 ]; then
error_and_exit "Could not detect RAM size."
fi