Memory leak in Coordinate::_lockFunction (a ModifiableConstant)
https://github.com/opensim-org/opensim-core/issues/127
Fixed it!
Check if _lockFunction is empty before allocating the memory.
Attachment is the code.
Is CMAES optimizer working well?
- Jiang Ping
- Posts: 132
- Joined: Sun Aug 26, 2012 4:09 am
Re: Is CMAES optimizer working well?
- Attachments
-
- Coordinate.h
- (12.83 KiB) Downloaded 48 times
-
- Coordinate.cpp
- (21.33 KiB) Downloaded 43 times
- Christopher Dembia
- Posts: 506
- Joined: Fri Oct 12, 2012 4:09 pm
Re: Is CMAES optimizer working well?
Hey Jiang:
Thanks for your enthusiasm. I looked at your code, and I don't see where you check if _lockFunction is null before allocating a new ModifiableConstant.
Sorry for the confusion, but this is one of the memory leaks that we *have* fixed, in the opensim-core repository. Here is the fix we used: https://github.com/opensim-org/opensim- ... /510/files.
If you are able to figure out some of the other ones, though, that would be excellent!
I'm aware of the leak in Delp1990Muscle_Deprecated and if you don't use this muscle then your fix is fine. However, in OpenSim we need an alternate fix that allows people to still use this class.
Thanks for your enthusiasm. I looked at your code, and I don't see where you check if _lockFunction is null before allocating a new ModifiableConstant.
Sorry for the confusion, but this is one of the memory leaks that we *have* fixed, in the opensim-core repository. Here is the fix we used: https://github.com/opensim-org/opensim- ... /510/files.
If you are able to figure out some of the other ones, though, that would be excellent!
I'm aware of the leak in Delp1990Muscle_Deprecated and if you don't use this muscle then your fix is fine. However, in OpenSim we need an alternate fix that allows people to still use this class.
- Jiang Ping
- Posts: 132
- Joined: Sun Aug 26, 2012 4:09 am
Re: Is CMAES optimizer working well?
hi,
Thank you very much for your information. Your memory leak fix for Coordinate.cpp also worked well for me.
I spent one week on locating where the code was hanging during the integration,
but unfortunately failed to find it. Finally, I created a win32 console application for my
objective function. And then created a child process to call it in each thread. Now the thread
is safe and optimizer works well.
And I also found another memory leak for CoordinateCoupledConstraint.cpp.
const SimTK::Function *f1 in class CompoundFunction was not released.
best regards,
jiang
Thank you very much for your information. Your memory leak fix for Coordinate.cpp also worked well for me.
I spent one week on locating where the code was hanging during the integration,
but unfortunately failed to find it. Finally, I created a win32 console application for my
objective function. And then created a child process to call it in each thread. Now the thread
is safe and optimizer works well.
And I also found another memory leak for CoordinateCoupledConstraint.cpp.
const SimTK::Function *f1 in class CompoundFunction was not released.
best regards,
jiang