After upgrading from zodb 4.4.5 to zodb 5.4.0 I experienced an increasing memory consumption in a daemon process I developed. At some point it saturated the whole memory in my server so I tried to understand what was going on, and I managed to reproduce the memory growth with this script:
import transaction
import ZODB
from BTrees.OOBTree import OOBTree
conn = ZODB.DB(None).open()
conn.root()["foobar"] = OOBTree()
transaction.commit()
for i in range(10 ** 7):
conn.root()["foobar"]
conn.cacheMinimize()
conn.close()
If you run this script with python 2.7 and zodb 5 the memory consumption of the python process will grow slowly but steadily. The size of the chunks I observed was sometimes 256kB, sometimes 4kB, but I do not really know how to reproduce specifically a growth by 256 or 4kB.
If you comment the line conn.cacheMinimize() or the line conn.root()["foobar"] the memory usage will not grow.
I wrote a proof of concept that generates a memory consumption chart comparison :

I also asked other developers at my company to test how the memory consumption behave on their computers with python 2.7, 3.4, 3.5, 3.6 and zodb 4.4.5 and zodb 5.4.0. The only case that always grows is python 2 and zodb 5. You can see the results here, with the Linux distributions used. We did not test on Mac or Windows.
After upgrading from zodb 4.4.5 to zodb 5.4.0 I experienced an increasing memory consumption in a daemon process I developed. At some point it saturated the whole memory in my server so I tried to understand what was going on, and I managed to reproduce the memory growth with this script:
If you run this script with python 2.7 and zodb 5 the memory consumption of the python process will grow slowly but steadily. The size of the chunks I observed was sometimes 256kB, sometimes 4kB, but I do not really know how to reproduce specifically a growth by 256 or 4kB.
If you comment the line
conn.cacheMinimize()or the lineconn.root()["foobar"]the memory usage will not grow.I wrote a proof of concept that generates a memory consumption chart comparison :

I also asked other developers at my company to test how the memory consumption behave on their computers with python 2.7, 3.4, 3.5, 3.6 and zodb 4.4.5 and zodb 5.4.0. The only case that always grows is python 2 and zodb 5. You can see the results here, with the Linux distributions used. We did not test on Mac or Windows.