Forked from pyrtsa/throttle-SourceKitService
Created
February 13, 2017 16:15
Revisions
-
pyrtsa created this gist
Jul 26, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ #!/bin/bash limit="${1-10000000}"; echo "Keeping SourceKitService below $limit KiB of virtual memory." echo "Hit ^C to quit." while true; do sleep 1; p=`pgrep ^SourceKitService$` if [ -n "$p" ]; then vsz=`ps -o vsz -p "$p" | tail -1` if [ $vsz -gt $limit ]; then kill -9 "$p"; echo "`date +%H:%M:%S` Killed SourceKitService $p at $vsz KiB of virtual memory." fi fi done