Embedded cover art, and other tags exposed to us as type Gst.Sample, were causing memory leaks when converted to plain Python types using GstBuffer.extractdup(). extractdup() expects the caller to free the memory it allocates but older versions of Python 3 PyGObject don't seem to do this. The workaround is to access buffer data using GstMemory methods instead.
This issue was found to be present on Buster 10 systems (python-gi 3.30.4) but not on Ubuntu 20.04 (python-gi 3.36.0).
Mopidy memory usage after scanning 2861 tracks: Without fix: 163.2MB With fix: 54.1MB