improve GC forcing code
add code to perform top_n efficiently