UnionAccess implementations leak memory if they heap-allocate their variants. This is because the visitors that call variantSeed have no way of knowing whether or not the variant was allocated.
Proposal
Just like with MapAccess's isKeyAllocated method, UnionAccess should be updated to have a isVariantAccess method, so that visitors can find out if a variant was allocated on the heap.
Problem
UnionAccess
implementations leak memory if they heap-allocate their variants. This is because the visitors that callvariantSeed
have no way of knowing whether or not the variant was allocated.Proposal
Just like with
MapAccess
'sisKeyAllocated
method,UnionAccess
should be updated to have aisVariantAccess
method, so that visitors can find out if a variant was allocated on the heap.Alternatives
No response
Additional Context
No response