optimize the share memory class