@@ -126,7 +126,7 @@ jobs:
126126
127127 # Setup mx, buildtools and labsjdk
128128 - name : Get mx, buildtools, and labsjdk
129- if : ${{ runner.os != 'Windows' && matrix.mx_version }}
129+ if : ${{ matrix.mx_version }}
130130 shell : bash
131131 run : |
132132 git clone https://github.com/graalvm/mx
@@ -190,8 +190,59 @@ jobs:
190190 run : |
191191 ${{ matrix.setup_steps }}
192192
193- - name : Check disk space
194- run : df -h
193+ - name : Check disk space and memory usage
194+ if : ${{ runner.os == 'macOS' }}
195+ run : |
196+ echo "before purge"
197+ df -h
198+ pagesize=$(sysctl -n hw.pagesize)
199+ vm_stat
200+ vm_stat | awk -v ps=$pagesize '
201+ /Pages free/ {free=$3}
202+ /Pages active/ {active=$3}
203+ /Pages inactive/ {inactive=$3}
204+ /Pages speculative/ {speculative=$3}
205+ /Pages wired/ {wired=$4}
206+ END {
207+ used=(active+inactive+wired+speculative)*ps/1024/1024;
208+ free=free*ps/1024/1024;
209+ printf "Used: %.2f MB\nFree: %.2f MB\n", used, free
210+ }'
211+ ps aux | sort -nrk 4 | head
212+ sudo purge
213+ echo "after purge"
214+ pagesize=$(sysctl -n hw.pagesize)
215+ vm_stat
216+ vm_stat | awk -v ps=$pagesize '
217+ /Pages free/ {free=$3}
218+ /Pages active/ {active=$3}
219+ /Pages inactive/ {inactive=$3}
220+ /Pages speculative/ {speculative=$3}
221+ /Pages wired/ {wired=$4}
222+ END {
223+ used=(active+inactive+wired+speculative)*ps/1024/1024;
224+ free=free*ps/1024/1024;
225+ printf "Used: %.2f MB\nFree: %.2f MB\n", used, free
226+ }'
227+
228+
229+ - name : Free resources on macOS
230+ run : |
231+ echo "Disabling Spotlight indexing..."
232+ sudo mdutil -a -i off
233+ sudo mdutil -a -d
234+ sudo launchctl bootout system /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
235+ sudo pkill -f "mds|mds_stores|mdworker_shared|Spotlight|corespotlightd"
236+
237+ echo "Forcing disk cache to be purged..."
238+ sudo purge
239+
240+ echo "Top processes sorted by memory usage:"
241+ ps -emo pid,pmem,pcpu,comm | head 2>/dev/null
242+ echo ""
243+ memory_pressure
244+ echo ""
245+ if : ${{ runner.os == 'macOS' }}
195246
196247 - name : Run on Unix
197248 working-directory : main
@@ -200,6 +251,7 @@ jobs:
200251 env
201252 ${{ matrix.run_steps }}
202253 - name : Run on Windows
254+ working-directory : main
203255 if : ${{ matrix.run_steps && runner.os == 'Windows' }}
204256 shell : cmd
205257 run : |
0 commit comments