After discovering that gedit apparently has a memory leak that causes it to consume more and more memory the longer it's left running, and after it corrupted a few .txt files while saving them, I went looking for a replacement.
I sudo apt purge
'd gedit, and installed Pluma, which is a fork of gedit. No more memory leaks, no more file corruption.
sudo apt show pluma
Package: pluma
Version: 1.24.0-1
Priority: optional
Section: universe/x11
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian+Ubuntu MATE Packaging Team <debian-mate@lists.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1,734 kB
Provides: mate-text-editor
Depends: gir1.2-peas-1.0, gir1.2-pluma-1.0 (= 1.24.0-1), iso-codes, mate-desktop-common, pluma-common (= 1.24.0-1), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.14), libcairo2 (>= 1.2.4), libenchant1c2a (>= 1.6.0), libgdk-pixbuf2.0-0 (>= 2.22.0), libgirepository-1.0-1 (>= 0.9.3), libglib2.0-0 (>= 2.37.3), libgtk-3-0 (>= 3.21.6), libgtksourceview-3.0-1 (>= 3.23.90), libice6 (>= 1:1.0.0), libpango-1.0-0 (>= 1.14.0), libpeas-1.0-0 (>= 1.0.0), libsm6, libx11-6, libxml2 (>= 2.7.4)
Recommends: zenity
Breaks: mate-text-editor (<< 1.5.0)
Replaces: mate-text-editor (<< 1.5.0)
Homepage: http://www.mate-desktop.org/
Task: ubuntukylin-desktop, ubuntu-mate-core, ubuntu-mate-desktop
Download-Size: 417 kB
APT-Manual-Installed: yes
APT-Sources: http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Description: official text editor of the MATE desktop environment
Pluma is a text editor which supports most standard editor features,
extending this basic functionality with other features not usually
found in simple text editors. Pluma is a graphical application which
supports editing multiple text files in one window (known sometimes as
tabs or MDI).
.
Pluma fully supports international text through its use of the
Unicode UTF-8 encoding in edited files. Its core feature set includes syntax
highlighting of source code, auto indentation and printing and print preview
support.
.
Pluma is also extensible through its plugin system, which currently
includes support for spell checking, comparing files, viewing CVS
ChangeLogs, and adjusting indentation levels.