I am guessing here but the issue with garbage collection may happen because Erlang is still keeping a copy of the queue which points to the old binary. Try making `limit_history` returns `{ new_history, should_garbage_collect }` instead and then `if should_garbage_collect, do: collect_binaries`. This would be more similar to how erlang shell currently behaves.