Memory accumulates in Serial Monitor

If I leave the Serial Monitor on for a long time and the my device prints a lot of information, over time, the memory used will accumulate leading to excessive swap and system hang.

Sounds like an issue with either the PlatformIO core (which is responsible for executing pio monitor) or the PlatformIO VSCode extension. I suggest you file a bug in

https://github.com/platformio/platformio-vscode-ide/issues