MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / resize

Method resize

src/storage/table/column_chunk_data.cpp:486–502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

484}
485
486void ColumnChunkData::resize(uint64_t newCapacity) {
487 const auto numBytesAfterResize = getBufferSize(newCapacity);
488 if (numBytesAfterResize > getBufferSize()) {
489 auto resizedBuffer = buffer->getMemoryManager()->allocateBuffer(false, numBytesAfterResize);
490 auto bufferSize = getBufferSize();
491 auto resizedBufferData = resizedBuffer->getBuffer().data();
492 memcpy(resizedBufferData, buffer->getBuffer().data(), bufferSize);
493 memset(resizedBufferData + bufferSize, 0, numBytesAfterResize - bufferSize);
494 buffer = std::move(resizedBuffer);
495 }
496 if (nullData) {
497 nullData->resize(newCapacity);
498 }
499 if (newCapacity > capacity) {
500 capacity = newCapacity;
501 }
502}
503
504void ColumnChunkData::resizeWithoutPreserve(uint64_t newCapacity) {
505 const auto numBytesAfterResize = getBufferSize(newCapacity);

Callers 2

resizeWithoutPreserveMethod · 0.45
splitMethod · 0.45

Calls 4

allocateBufferMethod · 0.80
getBufferMethod · 0.80
getMemoryManagerMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected