Merge pull request #366 from mmklee/memory_sw

Memory sw
fix: memory leaks in factorization