提交 09ac6206 编写于 作者: A Archit Mishra 提交者: Facebook Github Bot

Circumvent ASAN false positive

Summary:
Changes:
* checks if ASAN mode is on, and uses malloc and free in the constructor and destructor
Closes https://github.com/facebook/rocksdb/pull/2767

Differential Revision: D5671243

Pulled By: armishra

fbshipit-source-id: 8e4ad0f7f163400c4effa8617d3b30134119d802
上级 5b68b114
......@@ -234,19 +234,35 @@ void LRUCacheShard::EvictFromLRU(size_t charge,
}
void* LRUCacheShard::operator new(size_t size) {
#if __SANITIZE_ADDRESS__
return malloc(size);
#else
return port::cacheline_aligned_alloc(size);
#endif
}
void* LRUCacheShard::operator new[](size_t size) {
#if __SANITIZE_ADDRESS__
return malloc(size);
#else
return port::cacheline_aligned_alloc(size);
#endif
}
void LRUCacheShard::operator delete(void *memblock) {
#if __SANITIZE_ADDRESS__
free(memblock);
#else
port::cacheline_aligned_free(memblock);
#endif
}
void LRUCacheShard::operator delete[](void* memblock) {
#if __SANITIZE_ADDRESS__
free(memblock);
#else
port::cacheline_aligned_free(memblock);
#endif
}
void LRUCacheShard::SetCapacity(size_t capacity) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册