fixed coredump bug and memory leak under unix
use %p to print the address of pointer