Memory leak in tracker:strip-punctuation() helper
The following testcase will cause memory usage of tracker-miner-fs-3 to increase forever:
from pathlib import Path
import gi
from gi.repository import Tracker
conn = Tracker.SparqlConnection.bus_new("org.freedesktop.Tracker3.Miner.Files")
sparql = """
# Inputs: artist_name track_name
# Outputs: file duration
SELECT
?file
nfo:duration(?track) AS ?duration
FROM tracker:Audio
{
?track a nmm:MusicPiece ;
dc:title ?title ;
nie:isStoredAs ?file ;
nmm:artist ?artist .
?artist nmm:artistName ?artist_name .
FILTER (tracker:strip-punctuation(LCASE(?title)) = tracker:strip-punctuation(LCASE(~track_name)) &&
tracker:strip-punctuation(LCASE(?artist_name)) = tracker:strip-punctuation(LCASE(~artist_name)))
}
"""
stmt = conn.query_statement(sparql)
while True:
stmt.bind_string("artist_name", "foo")
stmt.bind_string("track_name", "bar")
cursor = stmt.execute()
while cursor.next():
pass
The culprit is tracker:strip-punctuation
- removing this causes memory usage to remain constant.