C struct garbage collection not run frequently enough

You can use jl_malloc/jl_calloc/jl_free to allocate memory in a way that is visible to the GC. You could set a function pointer in your library to these functions, and then use that function pointer.