File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,11 +74,26 @@ class PAIMON_EXPORT MemoryPool {
7474 // /
7575 // / Releases a previously allocated memory block back to the pool.
7676 // / The size must match the size used during allocation.
77+ // / The alignment used during allocation is not provided, subclass should store it
78+ // / by themselves if needed.
7779 // /
7880 // / @param p Pointer to the memory block to deallocate.
7981 // / @param size Size of the memory block (must match allocation size).
8082 virtual void Free (void * p, uint64_t size) = 0;
8183
84+ // / Deallocate memory back to the pool with specified alignment.
85+ // /
86+ // / Releases a previously allocated memory block back to the pool.
87+ // / The size and alignment must match the values used during allocation.
88+ // / Subclass can override this method to optimize deallocation based on alignment.
89+ // /
90+ // / @param p Pointer to the memory block to deallocate.
91+ // / @param size Size of the memory block (must match allocation size).
92+ // / @param alignment Alignment of the memory block (must match allocation alignment).
93+ virtual void Free (void * p, uint64_t size, uint64_t alignment) {
94+ Free (p, size);
95+ }
96+
8297 // / Get current memory usage.
8398 // /
8499 // / Returns the amount of memory currently allocated from this pool.
Original file line number Diff line number Diff line change @@ -46,8 +46,8 @@ class ArrowMemPoolAdaptor : public arrow::MemoryPool {
4646 return arrow::Status::OK ();
4747 }
4848
49- void Free (uint8_t * buffer, int64_t size, int64_t /* alignment= */ ) override {
50- pool_.Free (buffer, size);
49+ void Free (uint8_t * buffer, int64_t size, int64_t alignment) override {
50+ pool_.Free (buffer, size, alignment );
5151 stats_.DidFreeBytes (size);
5252 }
5353
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ class LuminaMemoryPool : public std::pmr::memory_resource {
4444 }
4545
4646 void do_deallocate (void * p, std::size_t bytes, std::size_t alignment) override {
47- pool_->Free (p, bytes);
47+ pool_->Free (p, bytes, alignment );
4848 }
4949
5050 bool do_is_equal (const std::pmr::memory_resource& other) const noexcept override {
You can’t perform that action at this time.
0 commit comments