Home › Forum › SOFA › Programming with SOFA › [SOLVED] Memory leak when using LocalMinDistance
Tagged: 32_bits, SOFA_1512, Windows_10
- This topic has 10 replies, 3 voices, and was last updated 8 years, 5 months ago by dilthoms.
-
AuthorPosts
-
1 May 2016 at 08:55 #6645dilthomsBlocked
There seems to be a memory leak when using LocalMinDistance for collision detection. This can be seen if the memory usage is monitored when there is continuous collision between two objects. I checked with v15.12 and the latest changes from master branch. I checked the code for LocalMinDistance as well as through valgrind tool but could not find what the issue was. Can someone point me in the right direction to fix this issue? Thanks.
3 May 2016 at 10:11 #6661HugoKeymasterDear Thomas,
I am no real expert in memory leak investigation, however, Valgrind seems to be definitely to be the best option.
I shortly looked into the code of “LocalMinDistance” but I couldn’t find an obvious problem (like a pointer which is not properly released, or missing delete on an instance). I’ll let you know if I can find it and I’ll also let other dev know about your issue.
Cheers,
Hugo
6 June 2016 at 14:38 #7027HugoKeymasterHi Thomas,
Any progress ? Did you succeed in finding the source of the memory leak?
If so, you can now pull-request your updates using GitHub.Cheers,
Hugo
9 June 2016 at 05:47 #7083dilthomsBlockedHi Hugo,
No, I have not been able to identify the cause of the memory leak.
9 June 2016 at 09:38 #7084HugoKeymasterHi Thomas,
Sorry to hear that.
I created an issue on GitHub to make sure to remember of the problem and maybe someone already solved it.Cheers,
Hugo
21 June 2016 at 15:12 #7127RomainBlockedHi Thomas,
I would like to reproduce this issue, Which collision model are involved? I tested the LocalMinDistance whith triangle/sphere interaction and I do not observe any leaks.
Do you have a scene which exhibit this memory leak?Cheers,
Romain.22 June 2016 at 16:53 #7130dilthomsBlockedHi Romain,
Thanks a lot for looking into the issue. All the scene files I have results in memory leak when the collision models are in continuous contact (the system memory steadily decreases). I use Point Line and Triangle collision models for both objects. An example scene file is at http://pastebin.com/XsTqqaR4
I would be happy to hear any other comments you might have about my scene file since I am fairly new to SOFA.
23 June 2016 at 12:48 #7131RomainBlockedThanks for the scene,
the problem occurs when you use collision models in different subgraphs containing each one their own solver. When a collision happens, the ContactGroupManager component gathers the subgraphs in a new node and create a new solver at its root to be able to manage the contact responses implicitly. When the collision stop, the graph is restored to its initial shape, the memory leak seems to come from the ContactGroupManager component (maybe temporary graph or component are not correctly deleted).Here is a simpler code which exhibit this issue: memory leak scene
You can avoid this problem by placing an unique implicit solver (with numerical solver) at the root of your scene. I also recommend you to use MinProximityIntersection or NewProximityIntersection (which is almost the same except that it only requires triangle model instead of triangle + line + point) instead of LocalMinDistance which seems a bit obsolete.
Cheers,
Romain.24 June 2016 at 06:13 #7134dilthomsBlockedHi Romain,
Thanks a ton for suggesting a solution. I will try it out.
The reason I was using LocalMinDistance was because of the suggestions in
http://lists.gforge.inria.fr/pipermail/sofa-users/2014-February/002051.html
http://lists.gforge.inria.fr/pipermail/sofa-users/2013-March/001598.htmlI found LocalMinDistance to be more stable than MinProximityIntersection. Is this true in general?
Thanks once again.
28 June 2016 at 19:41 #7178dilthomsBlockedHi Romain,
I tested the solution and it works well for scenes where I do not use FreeMotionAnimationLoop. Thanks a lot for the solution.
However, when I place the solvers at the root for a scene with FreeMotionAnimationLoop, the solvers do not seem to work – for example, the objects in the scene do not respond to keyboard movements. (They work when each subgraph contain its own solver.) Do you know how to handle this issue for scenes with FreeMotionAnimationLoop? Thanks.
28 June 2016 at 20:02 #7179dilthomsBlockedI have modified your example scene file to reproduce it – http://pastebin.com/v9pphzWN With FreeMotionAnimationLoop added and the solvers moved to the root, the moving object does not move anymore. If I move the solvers to each Node, it works fine. Any pointers will be a great help. Thanks.
-
AuthorPosts
- You must be logged in to reply to this topic.