-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
GCGarbage collectorGarbage collectormultithreadingBase.Threads and related functionalityBase.Threads and related functionality
Description
It is sometimes the case that a call to an external C library can take a long time; solvers are a good example. We've observed such a call taking tens of minutes, and while that was happening, another Julia thread triggered GC. At this point, all threads stop, except for the thread running the solver call and the program froze until the ccall returned, many minutes later.
If you know that the call to the external library does not manipulate Julia memory, then you can ccall jl_gc_safe_enter and jl_gc_safe_leave before and after the external call.
So:
- Is there another solution to this problem?
- If not, why is this solution not defined in
Base.GC(likeGC.safepoint) and documented? - Does it make sense to add a parameter to
ccallthat allows for it to be a GC safe region automatically?
mbauman and carstenbauer
Metadata
Metadata
Assignees
Labels
GCGarbage collectorGarbage collectormultithreadingBase.Threads and related functionalityBase.Threads and related functionality