Function to mark objects and remove killed buffers at once.