Hello.
Apologies if this is incorrect but we are assessing different solver libraries as the one we are currently using has issues with leaking boxed callbacks. It seems this is handled within the optimize function for the primary callback with fn_cfg_ptr being converted back into a Box and then dropped, but the same is not done for the constraint allocations c_cfg_ptr.
I am also wondering if the boxing of values here, as there are several more done within the optimize function, are unnecessary. This boxing is done and then references are passed to the converted C code, but seeing as none of the pointers passed outlive the optimize function, I think the boxing is unnecessary and passing in a pointer to the stack variables would be valid?
I have not looked into the generated Rust from C code, so I am not sure if this is a misunderstanding of how the C takes ownership of allocations.
Thanks
Hello.
Apologies if this is incorrect but we are assessing different solver libraries as the one we are currently using has issues with leaking boxed callbacks. It seems this is handled within the
optimizefunction for the primary callback withfn_cfg_ptrbeing converted back into aBoxand then dropped, but the same is not done for the constraint allocationsc_cfg_ptr.I am also wondering if the boxing of values here, as there are several more done within the
optimizefunction, are unnecessary. This boxing is done and then references are passed to the converted C code, but seeing as none of the pointers passed outlive theoptimizefunction, I think the boxing is unnecessary and passing in a pointer to the stack variables would be valid?I have not looked into the generated Rust from C code, so I am not sure if this is a misunderstanding of how the C takes ownership of allocations.
Thanks