THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
tupleSize = valueBaseOffset + valueAreaSize; // valueAreaSize goes from the last offset table entry
In order to build a tuple using minimum possible space it is required to learn two things:
Thus, generally speaking, building a binary tuple is a two-pass procedure. Sometimes it might be possible to turn this into a single pass (almost) by over-provisioning the allocated storage for the worst case and then fixing it up at the end.
1. IEP-54: Schema-first Approach
...