Filled/full to the gunwales/gunnels
The gunwales or ‘gun walls’ were originally where the guns of a ship were placed and the word date in this sense from the 1400s. The correct spelling is ‘gunwale’ but because the word is pronounced ‘gunnel’, the latter spelling has become acceptable according to the OED. The gunwales or gunnels are the topmost rims of the side of a ship and in smaller craft represent to topmost rim of planking. Filled or full to the gunwales or gunnels denotes that a ship has been loaded to the very maximum and when used figuratively it means the same thing as packed to the rafters/ceiling/ roof denoting a very crowded place, Filled to the gunwales or gunnels dates from around 1830.