Whenever Roon Server’s RAM usage goes above 5GB (or thereabouts) I start to experience laggy behaviour in the Roon client so wrote a script to check RAM usage and restart Roon Server when it exceeds 5GB. I don’t know if anyone else will find this useful, but have included it below. It works for me, but I haven’t checked it on any other systems, so YMMV.
set pid to do shell script "ps -A | grep RoonAppliance | grep -v grep | awk '{print $1}'"
set VMemRS to do shell script ("vmmap " & pid & "| grep 'written=' -A 1")
set relevant_bit1 to offset of "written=" in VMemRS
set the_starting_point to relevant_bit1 + 8
set relevant_bit2 to offset of "(" in VMemRS
set the_ending_point to relevant_bit2 - 2
set RAM_usage to characters the_starting_point thru the_ending_point of VMemRS as string
if RAM_usage > 5 then
try
tell application "RoonServer" to quit
delay 10
tell application "RoonServer" to activate
set theDialogText to "RAM Usage was " & RAM_usage & " GB when Roon Server was restarted."
display alert theDialogText
end try
end if
I have this embedded in another (constantly running) script, that runs the check at 5.30 in the morning.
A shorter version, which you can use to just get the info on how much RAM is being used, is as follows. You can save this as an AppleScript app or assign it to a key sequence (using something like Better Touch Tool).
set pid to do shell script "ps -A | grep RoonAppliance | grep -v grep | awk '{print $1}'"
set VMemRS to do shell script ("vmmap " & pid & "| grep 'written=' -A 1")
set relevant_bit1 to offset of "written=" in VMemRS
set the_starting_point to relevant_bit1 + 8
set relevant_bit2 to offset of "(" in VMemRS
set the_ending_point to relevant_bit2 - 2
set RAM_usage to characters the_starting_point thru the_ending_point of VMemRS as string
set theText to "Roon Server is currenty using " & RAM_usage & " GB of RAM"
display alert theText