It may not address the memory issue, but can you build 3.10 with the same options you used for 3.6? It is currently a debugging build:
########################################################## # # # WARNING!!! # # # # This code was compiled with a debugging option. # # To get timing results run ./configure # # using --with-debugging=no, the performance will # # be generally two or three times faster. # # # ##########################################################