init_once makes it possible to allocate with one malloc and free with another
This was found in https://github.com/JuliaLang/julia/pull/60568 when running the MinFEM tests with that PR, specifically the poisson_test.jl file. Basically what seems to happen is that `umfpack_dl_numeric` calls SuiteSparse_malloc which before calling into CHOLMOD points to the libc allocator, but after we initialize it in `init_once` it points to the jl_malloc allocator. Currently this doesn't cause segfaults but will cause the GC to miscount, but with mimalloc this segfaults. That initialization needs to either be a __init__ or be called whenever any function may call any of the SuiteSparse_malloc and related
2 条评论