add free memory and add virtual destructor