[BUG] Fix Memory Leak in SchemaChange And Fix some DCHECK error (#5491)

This commit is contained in:
stdpain
2021-03-17 09:27:05 +08:00
committed by GitHub
parent 105a86d1cd
commit a1bce25677
16 changed files with 180 additions and 154 deletions

View File

@ -604,6 +604,19 @@ void RowBatch::acquire_state(RowBatch* src) {
src->transfer_resource_ownership(this);
}
void RowBatch::deep_copy_to(RowBatch* dst) {
DCHECK(dst->_row_desc.equals(_row_desc));
DCHECK_EQ(dst->_num_rows, 0);
DCHECK_GE(dst->_capacity, _num_rows);
dst->add_rows(_num_rows);
for (int i = 0; i < _num_rows; ++i) {
TupleRow* src_row = get_row(i);
TupleRow* dst_row = reinterpret_cast<TupleRow*>(dst->_tuple_ptrs + i * _num_tuples_per_row);
src_row->deep_copy(dst_row, _row_desc.tuple_descriptors(), dst->_tuple_data_pool.get(),
false);
}
dst->commit_rows(_num_rows);
}
// TODO: consider computing size of batches as they are built up
int RowBatch::total_byte_size() {
int result = 0;