Hi,
It appears there is a memory leak when running the IK using the IKTool (in the API but also from Jython in the GUI).
Is it a known issue ? Is there a way to fix this ?
It is a major problem for me as I am trying to run an optimization process using it. Unifortunately the leak seems to add 10Mo of memory at each IK run thus my RAM gets full and the processing end up crashing.
The only way to release memory seems to be restarting the kernel...
Any help would be appreciated.
Thank you,
Felix Lefebvre
IKTool Run Memory Leak Python API
- Félix Lefebvre
- Posts: 16
- Joined: Fri Oct 05, 2018 5:41 am
- Ayman Habib
- Posts: 2239
- Joined: Fri Apr 01, 2005 12:24 pm
Re: IKTool Run Memory Leak Python API
Hi Felix,
Can you send a code snippet to reproduce the leak? Ideally you can write a C++ equivalent snippet so we know if the issue is specific to the python/java bindings or the underlying C++ layer as the memory management could be different between the environments (garbage collection comes into play).
Best regards,
-Ayman
Can you send a code snippet to reproduce the leak? Ideally you can write a C++ equivalent snippet so we know if the issue is specific to the python/java bindings or the underlying C++ layer as the memory management could be different between the environments (garbage collection comes into play).
Best regards,
-Ayman
- Félix Lefebvre
- Posts: 16
- Joined: Fri Oct 05, 2018 5:41 am
Re: IKTool Run Memory Leak Python API
Please see a very simple example that shows how memory leaks and increase. Release only happens when closing Python (or restarting the kernel).
I just the following demo files in the folder:
- subject01_Setup_IK.xml
- subject01_simbody.osim
- subject01_walk1.trc
I am not very comfortable with C++ but I will see what I can do.
Thank you for your help.
Code: Select all
import os.path
import opensim as osim
Folder = "C:/Users/felix/Documents/OpenSim/4.3/Code/Python/TestIK/"
scaleModelName = os.path.join(Folder, "subject01_simbody.osim");
ikSetupFile = os.path.join(Folder,"subject01_Setup_IK.xml");
## Inverse Kinematics tool
# Create the IK tool object from existing xml
ikTool = osim.InverseKinematicsTool(ikSetupFile)
ikTool.set_model_file(scaleModelName)
for i in range(0,100):
ikTool.run()
print(i)
- subject01_Setup_IK.xml
- subject01_simbody.osim
- subject01_walk1.trc
I am not very comfortable with C++ but I will see what I can do.
Thank you for your help.
- Ayman Habib
- Posts: 2239
- Joined: Fri Apr 01, 2005 12:24 pm
Re: IKTool Run Memory Leak Python API
Thanks much Felix,
That's all we need, no need to translate this to C++ we can do it on our side and we'll make sure it's fixed in the upcoming 4.4 release.
Best regards,
-Ayman
That's all we need, no need to translate this to C++ we can do it on our side and we'll make sure it's fixed in the upcoming 4.4 release.
Best regards,
-Ayman
- Félix Lefebvre
- Posts: 16
- Joined: Fri Oct 05, 2018 5:41 am
Re: IKTool Run Memory Leak Python API
Hi Ayman,
Thank you for taking this into account.
Do you have an estimated deadline for this release ?
So that I know if I can wait or should look for a workaround as a short term solution.
Thank you,
Felix
Thank you for taking this into account.
Do you have an estimated deadline for this release ?
So that I know if I can wait or should look for a workaround as a short term solution.
Thank you,
Felix
- Ayman Habib
- Posts: 2239
- Joined: Fri Apr 01, 2005 12:24 pm
Re: IKTool Run Memory Leak Python API
Hi Felix,
The issue has been fixed already in development builds and will be available in the beta build of version 4.4 expected within days. You should receive an announcement email if you subscribed to our mailing list earlier. Please let us know when you test it out.
If you want to test the development build please reach out to us on github at https://github.com/opensim-org/opensim-core
Thanks again for reporting,
-Ayman
The issue has been fixed already in development builds and will be available in the beta build of version 4.4 expected within days. You should receive an announcement email if you subscribed to our mailing list earlier. Please let us know when you test it out.
If you want to test the development build please reach out to us on github at https://github.com/opensim-org/opensim-core
Thanks again for reporting,
-Ayman
- Félix Lefebvre
- Posts: 16
- Joined: Fri Oct 05, 2018 5:41 am
Re: IKTool Run Memory Leak Python API
Hi Ayman,
Just to inform you that I tested the beta 4.4-2022-06-11-bfc372a and it seems solved indeed !
Thank you very much for your reactivity and prompt fixing, it is very much appreciated.
Felix
Just to inform you that I tested the beta 4.4-2022-06-11-bfc372a and it seems solved indeed !
Thank you very much for your reactivity and prompt fixing, it is very much appreciated.
Felix
- Ayman Habib
- Posts: 2239
- Joined: Fri Apr 01, 2005 12:24 pm
Re: IKTool Run Memory Leak Python API
Thanks for the update and for testing Felix, it sure helps us make the software more robust for the whole user community.
Best regards,
-Ayman
Best regards,
-Ayman