Running the official Minecraft server 1.18.1 and walking for some time (30 Minutes) causes out of memory error which eventually crashes the server.
The world exists since version 1.12 and was used in every following version. The Failure happens now since version 1.18.
Converting (optimizing) the world for 1.18.1 didn't make a difference.
Memory heap full after about 15 minutes travelling by rail in an old (1.17 and lower) world. Happens in MC and dedicated vanilla server. The Memory usage shows free memory in the range of 45 - 90 %, later only 95 - 99 % and later on, the game hangs or crashes.
A test world is available at the following URL:
Test world containing the extracted long railroad.
(Server is only online from 8:30 to 23:00, UTC)
Download ist and extract it to your Minecraft "saves" directory.
Play this game. Follow the instruction on the attached screenshots.