using resource dtor replace delete the variable on mmseg_close
remove tmp works