chenBright commented on code in PR #2890:
URL: https://github.com/apache/brpc/pull/2890#discussion_r1949106675


##########
src/butil/object_pool_inl.h:
##########
@@ -85,6 +86,29 @@ class ObjectPoolBlockItemNum {
 
 template <typename T>
 class BAIDU_CACHELINE_ALIGNMENT ObjectPool {
+private:
+#ifdef BUTIL_USE_ASAN
+    static void asan_poison_memory_region(T* ptr) {
+        if (!ObjectPoolWithASanPoison<T>::value || NULL == ptr) {
+            return;
+        }
+        // Marks the object as addressable.
+        BUTIL_ASAN_POISON_MEMORY_REGION(ptr, sizeof(T));
+    }
+    static void asan_unpoison_memory_region(T* ptr) {
+        if (!ObjectPoolWithASanPoison<T>::value || NULL == ptr) {
+            return;
+        }
+        // Marks the object as unaddressable.
+        BUTIL_ASAN_UNPOISON_MEMORY_REGION(ptr, sizeof(T));
+    }
+#define OBJECT_POOL_ASAN_POISON_MEMORY_REGION(ptr) 
asan_poison_memory_region(ptr)
+#define OBJECT_POOL_ASAN_UNPOISON_MEMORY_REGION(ptr) 
asan_unpoison_memory_region(ptr)
+#else
+    #define OBJECT_POOL_ASAN_POISON_MEMORY_REGION(ptr) ((void)(ptr))

Review Comment:
   done



##########
src/bthread/task_group.cpp:
##########
@@ -255,6 +297,15 @@ int TaskGroup::init(size_t runqueue_capacity) {
     return 0;
 }
 
+#ifdef BUTIL_USE_ASAN
+void TaskGroup::bthread_task_runner(intptr_t) {

Review Comment:
   done



-- 
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: dev-unsubscr...@brpc.apache.org

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


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

Reply via email to