What is a custom mark function supposed to return?

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.

In case anyone else is curious, I figured out it’s the number of pointers to young objects based on this test: julia/gcext.c at 7cbf55f4677d243629e685348726ab4941a50706 · JuliaLang/julia · GitHub