Skip to content

Instantly share code, notes, and snippets.

View jbreindel's full-sized avatar

Jake Breindel jbreindel

View GitHub Profile
init([]) ->
% Start the scheduled GC job every minute. Naive!
erlang:send_after(60 * 1000, self(), {gc}),
{ok, no_state}.
handle_info({gc}, State) ->
case erlang:memory(binary) of
% We use more than 500 MB of binary space
Binary when Binary > 500000000 ->
erlang:garbage_collect(self())
init([]) ->
% Start the scheduled GC job every minute. Naive!
erlang:send_after(60 * 1000, self(), {gc}),
{ok, no_state}.
handle_info({gc}, State) ->
erlang:garbage_collect(self()),
erlang:send_after(60 * 1000, self(), {gc}),
{noreply, State}.
@jbreindel
jbreindel / build-erlang-17.0.sh
Created November 28, 2015 17:04 — forked from bryanhunter/build-erlang-17.0.sh
Build Erlang 17.0 on a fresh Ubuntu box (tested on 12.04 and 14.04)
#!/bin/bash
# Pull this file down, make it executable and run it with sudo
# wget https://gist.githubusercontent.com/bryanhunter/10380945/raw/build-erlang-17.0.sh
# chmod u+x build-erlang-17.0.sh
# sudo ./build-erlang-17.0.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi