MerginMaps / db-sync

A tool for two-way synchronization between Mergin Maps and a PostGIS database
https://merginmaps.com
MIT License
45 stars 20 forks source link

Fix memory leak related to MerginProject object #79

Closed wonder-sk closed 1 year ago

wonder-sk commented 1 year ago

Fixes #78

It turns out that we are creating MerginProject objects way too much, and the cleanup of it may not be handled properly because of a cyclic reference between MerginProject and its internal GeoDiff context object.

It is going to be both safer and faster to create MerginProject for a particular working directory once and then keep it cached.

Fun fact: the leak is not showing up in "top" commend, only in docker's stats about memory...