memory leak while debugging python code with gtsam

22 views
Skip to first unread message

Yotam Stern

unread,
Jun 14, 2025, 2:58:01 PMJun 14
to gtsam users
Hi everyone, I have a stable code I've been using for a while which runs visual slam, I'm solving large problems with thousands of frames incrementally, I'm using my own implementation and not ISAM2, so my code is running several hundred batch optimization with LM optimizer during the process.

typical run takes around 40 minutes and <8GB of RAM, up until now i have been using a constant noise model for all projection factors, but since i know the rectification model and parameters of my camera, i have decided to calculate the covariance per point and take the rectification into account to get more accurate solution.

Ever since i'm made this change the process is running much slower and memory is spiking up to 64GB when it reaches my machine limit and is killed. This only happens while in debug mode, if i just run the python script it all works perfectly fine running fast and not using more than 8GB of RAM.

Has anyone encountered such behavior before? I would like to point out that according to expectations this change had improved the accuracy of the SLAM results when compared to GT data. so its something i would want to keep, but it makes development nearly impossible without being able to debug.

Dellaert, Frank

unread,
Jun 14, 2025, 6:07:48 PMJun 14
to Yotam Stern, gtsam users
Hmmm, no idea. Typically, you would see something happen in release and then not in debug mode, that’s the more common pattern.

Maybe you could run this with some memory corruption tool (eg valgrind), see what you get?


Frank

From: gtsam...@googlegroups.com <gtsam...@googlegroups.com> on behalf of Yotam Stern <sht...@gmail.com>
Sent: Saturday, June 14, 2025 8:58:00 PM
To: gtsam users <gtsam...@googlegroups.com>
Subject: [GTSAM] memory leak while debugging python code with gtsam
 
--
You received this message because you are subscribed to the Google Groups "gtsam users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gtsam-users...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/gtsam-users/7b9a3c5c-f724-457e-bfbf-9fd243268742n%40googlegroups.com.

Mike Sheffler

unread,
Jun 15, 2025, 9:53:03 PMJun 15
to Dellaert, Frank, Yotam Stern, gtsam users
Perhaps a dumb question, but is the memory use just _much larger_, or does it actually _grow_ as time passes? That is, could we just have a lot of temporaries and stuff that are normally optimized out (and now taking up a ton of memory), or does it actually seem to leaking and you reach max memory as time passes?

Mike Sheffler

Sent from Gmail Mobile


Yotam Stern

unread,
Jun 16, 2025, 3:09:43 AMJun 16
to Mike Sheffler, Dellaert, Frank, gtsam users
Hi thanks for the reply, I think my original post wasn't clear, I meant running a default gtsam package not built for debug, only the python  code was running in debug, but since then i found out its a new "feature" in latest version of pycharm regardless of the change in my in my gtsam code. older versions of pycharm lacked this memory leak. i'll take it on with them.
Reply all
Reply to author
Forward
0 new messages