remove guard, memory
fix double free in debug
Refactor some malloc/free to new/delete
Refactor MatMap