         kind, reason ->
           # would love to have this in a separate function, but elixir 1.7 complains
           send(tracer, :done)
-          send(parent, :shutdown)
+          send(parent, {ref, :shutdown})
           stacktrace = System.stacktrace()
           IO.puts(Exception.format(kind, reason, stacktrace))
           exit(:normal)

      :ready_to_begin -> nil
    end

    fun.()
    :erlang.garbage_collect()
    send(tracer, :end_collection)


      tracer = start_tracer(self())

      try do
        _ = measure_memory(fun, tracer, parent)
        word_size = :erlang.system_info(:wordsize)
        memory_used = get_collected_memory(tracer)
        send(parent, {ref, memory_used * word_size})
