init memroy .
 fixbug in unittests and reimplement use std::thread