It sounds like a memory leak. When memory gets very low it gets very slow. Leaving it longer would probably cause kodi to be killed and restarted.
The leak was found with a recording from tvheadend. Apparently the latest tvheadend server doesn’t cause the issue (it related to storing unused streams in the file).
There is a fix for this, but it’s not in current stable build (hopefully will be in next update).
The fix should be in the testing builds:
but be aware these are bleeding edge, so could have other issues. May be interesting to learn if that build fixes the issue.