xinyiZzz commented on code in PR #48924:
URL: https://github.com/apache/doris/pull/48924#discussion_r1991244866


##########
be/src/olap/page_cache.h:
##########
@@ -37,33 +37,54 @@ namespace doris {
 
 class PageCacheHandle;
 
-template <typename TAllocator>
-class PageBase : private TAllocator, public LRUCacheValueBase {
+template <typename T>
+class MemoryTrackedPageBase : public LRUCacheValueBase {
 public:
-    PageBase() = default;
-    PageBase(size_t b, bool use_cache, segment_v2::PageTypePB page_type);
-    PageBase(const PageBase&) = delete;
-    PageBase& operator=(const PageBase&) = delete;
-    ~PageBase() override;
+    MemoryTrackedPageBase() = default;
+    MemoryTrackedPageBase(size_t b, bool use_cache, segment_v2::PageTypePB 
page_type);
 
-    char* data() { return _data; }
+    MemoryTrackedPageBase(const MemoryTrackedPageBase&) = delete;
+    MemoryTrackedPageBase& operator=(const MemoryTrackedPageBase&) = delete;
+    ~MemoryTrackedPageBase() = default;
+
+    T data() { return _data; }
     size_t size() { return _size; }
-    size_t capacity() { return _capacity; }
+
+protected:
+    T _data;
+    size_t _size = 0;
+    std::shared_ptr<MemTrackerLimiter> _mem_tracker_by_allocator;

Review Comment:
   LRUCacheValueBase 里有一个 ` std::shared_ptr<MemTrackerLimiter> _mem_tracker` 
可以复用
   
   之前 PageBase 忘记复用了,可以顺手改了



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to