1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

feat(): dangling pointer/ref issue has been solved for both RGData and BS

This commit is contained in:
drrtuy
2024-12-13 15:03:56 +00:00
parent fac7dfa552
commit 1c297b9e9e
9 changed files with 56 additions and 67 deletions

View File

@ -101,7 +101,7 @@ ByteStream::ByteStream(uint32_t initSize) : fBuf(0), fCurInPtr(0), fCurOutPtr(0)
}
// WIP remove this one, replacing the allocator arg with a default nullptr.
ByteStream::ByteStream(allocators::CountingAllocator<uint8_t>* allocator, uint32_t initSize)
ByteStream::ByteStream(allocators::CountingAllocator<uint8_t>& allocator, uint32_t initSize)
: fBuf(0), fCurInPtr(0), fCurOutPtr(0), fMaxLen(0), allocator(allocator)
{
if (initSize > 0)

View File

@ -19,6 +19,7 @@
*/
#pragma once
#include <optional>
#include <string>
#include <iostream>
#include <sys/types.h>
@ -78,7 +79,7 @@ class ByteStream : public Serializeable
* default ctor
*/
EXPORT explicit ByteStream(uint32_t initSize = 8192); // multiples of pagesize are best
explicit ByteStream(allocators::CountingAllocator<BSBufType>* alloc, uint32_t initSize = 8192);
explicit ByteStream(allocators::CountingAllocator<BSBufType>& alloc, uint32_t initSize = 8192);
/**
* ctor with a uint8_t array and len initializer
*/
@ -476,7 +477,7 @@ class ByteStream : public Serializeable
uint32_t fMaxLen; // how big fBuf is currently
// Stores `long strings`.
std::vector<rowgroup::StringStoreBufSPType> longStrings;
allocators::CountingAllocator<BSBufType>* allocator = nullptr;
std::optional<allocators::CountingAllocator<BSBufType>> allocator = {};
};
template <int W, typename T = void>