julia
julia copied to clipboard
flisp: Fix memory leaks
There's two independent issues here:
-
The table allocator assumes that small tables will be stored inline and do not need a finalizer. This is mostly true, except that hash collisions can cause premature growing of the inline table, so even for relatively small tables, we need to validate that the storage was not allocated out-of-line.
-
It is unsafe to clear the vtable finalizer pointer during the table allocation to supress the
add_finalizercall. This is because the allocation of the table object itself may trigger GC of a different table, and without the finalizer set in the vtable, freeing of that table's memory space would get skipped.
Fixes #13540 ;)