Eventually we'll probably want something smarter than this, but for the time being this helps stop runaway memory usage.