Skip to content

Instantly share code, notes, and snippets.

@zed9h
zed9h / purge.c
Last active August 29, 2015 14:06
Does your Mac OSX 10.9.4 Mavericks do a bad job at memory management? Use this script to force it to free some memory. Run it passing the amount of gigs of ram you have (default 8gb) and [optionally] wait the chart on the Memory tab of Activity Monitor to display some yellow and red.
#if 0
BIN=`mktemp $0.bin.XXXX`
trap "rm -fv $BIN" 0
gcc -O3 $0 -Wall -Werror -o $BIN && $BIN $1
exit
#endif
#include<stdio.h>
#include<stdlib.h>