Throw proper exception when memory size exceeded in TopN