You can create foreign types that have custom mark and sweep functions with jl_new_foreign_type
. The custom mark function must return a uintptr_t
, but it’s undocumented what should be returned exactly.
The custom mark is called here, my assumption is that either it needs to return 1 if the instance of the foreign type contains at least one pointer to a young object, or that it needs to return the number of pointers to young objects, but I’m not sure.