Memory leak in pyuci?

I have a distinct ever-growing-never-freed memory usage in the following simple python main; tracemalloc points to the anonymous uci.get.
On our host, firewall is the biggest (wc) config, but the leak is evident in smaller configurations too (though more slow).

Is this a known issue?
The machine is an ar300m-gl-inet sbc with custom image, compiled off openwrt 22.03,5.

import time
import tracemalloc

import uci

tracemalloc.start()

def loop_memory_test() -> None:

    iterations = 10000
    one = 0
    while one < iterations:
        with uci.Uci() as _uci:
            _ = _uci.get("firewall")
        one += 1
        snapshot = tracemalloc.take_snapshot()
        top_stats = snapshot.statistics('lineno')
        for stat in top_stats[:10]:
            print(f"{stat=}")
        if one % 100 == 0:
            time.sleep(2)
    tracemalloc.stop()


if __name__ == "__main__":
    loop_memory_test()

If you are wondering whether tracemalloc could be the curlpit - I reproduced the "leak" without it, and added it later, as a measure of troubleshooting.

pyuci is a Turris project and not maintained by OpenWrt. You might get a better/more authoritative answer from those folks.

1 Like

Thank for your guidance; posted an issue there