export of sparse matrix to (i,j,value) tuple
fix missing heap cleanup