For a string column with local dictionary enabled, a column page of
`UnsafeFixLengthColumnPage` with datatype `DataTypes.BYTE_ARRAY` is created for `encodedPage` along with regular `actualPage` of `UnsafeVarLengthColumnPage`.
We have `capacity` field in the `UnsafeFixLengthColumnPage`. And this field indicates the capacity of allocated
`memoryBlock` for the page. `ensureMemory()` method gets called while adding rows to check if `totalLength + requestSize > capacity` to allocate a new memoryBlock. If there is no room to add the next row, allocates a new block, copy the old context(prev rows) and free the old memoryBlock.
While, `UnsafeFixLengthColumnPage` with with datatype `DataTypes.BYTE_ARRAY` is created for `encodedPage`, we have not assigned the `capacity` field with allocated memory block size. Hence, for each add row to tablePage, ensureMemory() check always fails, allocates a new column page memoryBlock, copy the old context(prev rows) and free the old memoryBlock. This allocation of new memoryBlock and free of old memoryBlock happens for each row row addition for the string columns with local dictionary.
In`VarLengthColumnPageBase`, we have a `rowOffset` column page of `UnsafeFixLengthColumnPage` of datatype `INT`
to maintain the data offset to each row of variable length columns. This `rowOffset` page allocates to be size of page.
If we have 10 rows in the page, we need 11 rows for its rowOffset page. Because we always keep 0 as offset to 1st row. So an additional row is required for rowOffset page[pasted code below to show the reference]. Otherwise, ensureMemory() check always fails for the last row(10th row in this case) of data and allocates a new rowOffset page memoryBlock, copy the old context(prev rows) and free the old memoryBlock. This can happen for the string columns with local dictionary, direct dictionary columns, global disctionary columns.