Skip to content

Leak of constraint functions #26

Description

@Yen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions