HiGHS instance and model when used in a shared library

Update: we stripped down to an as-minimal example as possible. The @ccallable now is just a completely void function, not receiving or returning anything, and not performing anything at all.

With that, we can even --trim=safe it, so there’s nothing dynamic going on anymore.

Still, we get a segfault when calling the function in the library from Java, on a single thread, under Linux, after something like 5000 to 8000 calls. We do not get segfaults under Windows, and neither when calling the library (for 100k times) from Go (instead of Java).

So, there seems to be something in how Java handles C shared libs that does not play nicely with Julia. And it also seems that there is not problem with how JuMP/HiGHS handle memory in the shared libs they interface as artifacts.

4 Likes