solve mem-leak problem, and use dmalloc as mem-check tool