free some memory and init staticvarible