diff --git a/tiledb/common/memory_tracker.h b/tiledb/common/memory_tracker.h index 8b11069dc86d..3f03c75df7a9 100644 --- a/tiledb/common/memory_tracker.h +++ b/tiledb/common/memory_tracker.h @@ -104,6 +104,7 @@ enum class MemoryType { ENUMERATION, ENUMERATION_PATHS, FOOTER, + FILTERED_DATA, FILTERED_DATA_BLOCK, GENERIC_TILE_IO, RTREE, diff --git a/tiledb/common/pmr.h b/tiledb/common/pmr.h index 0005868f4fc3..1692f0b8158a 100644 --- a/tiledb/common/pmr.h +++ b/tiledb/common/pmr.h @@ -34,6 +34,7 @@ #ifndef TILEDB_COMMON_PMR_H #define TILEDB_COMMON_PMR_H +#include #include #include @@ -119,6 +120,67 @@ unique_ptr make_unique(memory_resource* resource, size_t size) { return make_unique(resource, size, alignof(Tp)); } +/* ********************************* */ +/* PMR LIST DECLARATION */ +/* ********************************* */ +template +using pmr_list = std::list>; + +template +class list : public pmr_list { + public: + using value_type = typename pmr_list::value_type; + using allocator_type = typename pmr_list::allocator_type; + using size_type = typename pmr_list::size_type; + using difference_type = typename pmr_list::difference_type; + using reference = typename pmr_list::reference; + using const_reference = typename pmr_list::const_reference; + using pointer = typename pmr_list::pointer; + using const_pointer = typename pmr_list::const_pointer; + using iterator = typename pmr_list::iterator; + using const_iterator = typename pmr_list::const_iterator; + using reverse_iterator = typename pmr_list::reverse_iterator; + using const_reverse_iterator = typename pmr_list::const_reverse_iterator; + + // Delete all default constructors because they don't require an allocator + list() = delete; + list(const list& other) = delete; + list(list&& other) = delete; + + // Delete non-allocator aware copy and move assign. + list& operator=(const list& other) = delete; + list& operator=(list&& other) noexcept = delete; + + explicit list(const allocator_type& alloc) noexcept + : pmr_list(alloc) { + } + + explicit list(size_type count, const Tp& value, const allocator_type& alloc) + : pmr_list(count, value, alloc) { + } + + explicit list(size_type count, const allocator_type& alloc) + : pmr_list(count, alloc) { + } + + template + list(InputIt first, InputIt last, const allocator_type& alloc) + : pmr_list(first, last, alloc) { + } + + list(const list& other, const allocator_type& alloc) + : pmr_list(other, alloc) { + } + + list(list&& other, const allocator_type& alloc) + : pmr_list(other, alloc) { + } + + list(std::initializer_list init, const allocator_type& alloc) + : pmr_list(init, alloc) { + } +}; + /* ********************************* */ /* PMR VECTOR DECLARATION */ /* ********************************* */ diff --git a/tiledb/sm/query/readers/filtered_data.h b/tiledb/sm/query/readers/filtered_data.h index b8615c90b5fa..4b66a38dd3a2 100644 --- a/tiledb/sm/query/readers/filtered_data.h +++ b/tiledb/sm/query/readers/filtered_data.h @@ -190,6 +190,12 @@ class FilteredData { std::vector& read_tasks, shared_ptr memory_tracker) : memory_tracker_(memory_tracker) + , fixed_data_blocks_( + memory_tracker_->get_resource(MemoryType::FILTERED_DATA)) + , var_data_blocks_( + memory_tracker_->get_resource(MemoryType::FILTERED_DATA)) + , nullable_data_blocks_( + memory_tracker_->get_resource(MemoryType::FILTERED_DATA)) , name_(name) , fragment_metadata_(fragment_metadata) , var_sized_(var_sized) @@ -395,7 +401,7 @@ class FilteredData { } /** @return Data blocks corresponding to the tile type. */ - inline std::list& data_blocks(const TileType type) { + inline tdb::pmr::list& data_blocks(const TileType type) { switch (type) { case TileType::FIXED: return fixed_data_blocks_; @@ -409,7 +415,7 @@ class FilteredData { } /** @return Current data block corresponding to the tile type. */ - inline std::list::iterator& current_data_block( + inline tdb::pmr::list::iterator& current_data_block( const TileType type) { switch (type) { case TileType::FIXED: @@ -592,22 +598,22 @@ class FilteredData { shared_ptr memory_tracker_; /** Fixed data blocks. */ - std::list fixed_data_blocks_; + tdb::pmr::list fixed_data_blocks_; /** Current fixed data block used when creating fixed tiles. */ - std::list::iterator current_fixed_data_block_; + tdb::pmr::list::iterator current_fixed_data_block_; /** Var data blocks. */ - std::list var_data_blocks_; + tdb::pmr::list var_data_blocks_; /** Current var data block used when creating var tiles. */ - std::list::iterator current_var_data_block_; + tdb::pmr::list::iterator current_var_data_block_; /** Nullable data blocks. */ - std::list nullable_data_blocks_; + tdb::pmr::list nullable_data_blocks_; /** Current nullable data block used when creating nullable tiles. */ - std::list::iterator current_nullable_data_block_; + tdb::pmr::list::iterator current_nullable_data_block_; /** Name of the attribute. */ const std::string& name_;