use shared_ptr from the boost library to handle the memory leak problem