Fixed heap performance issue