Simplify variant, arrays, no leaks in check_memory

Array de/encoding now takes a vtable entry instead of an id. This saves many lookups.
The encodingbyte of variants is no longer stored explicitly, but inferred from the other values. => A single source of truth of what is contained in the variant.