The easiest way for ships to do this is to liquefy the leftover food in an industrial grinder. The food is blended with water until it's a smooth mixture and then either disposed of in port, incinerated, or pumped out to sea when the ship is deep water and away from the coastlines. Simple as that.