diff --git a/Makefile b/Makefile index 9b80864fc..a657fad72 100644 --- a/Makefile +++ b/Makefile @@ -259,19 +259,6 @@ default: all WARNING_FLAGS = -W -Wextra -Wall -Wsign-compare -Wshadow \ -Wno-unused-parameter -CCVERSION = $(shell $(CXX) -dumpversion) -CCNAME = $(shell $(CXX) --version | awk 'NR==1' | cut -f1 -d " ") - -ifeq ($(CCNAME), clang) -ifeq ($(CCVERSION), 4*) - CXXFLAGS += -faligned-new -endif -else -ifeq ($(CCVERSION), 7) - CXXFLAGS += -faligned-new -endif -endif - ifndef DISABLE_WARNING_AS_ERROR WARNING_FLAGS += -Werror endif diff --git a/cache/lru_cache.cc b/cache/lru_cache.cc index f833374e7..a78a52dff 100644 --- a/cache/lru_cache.cc +++ b/cache/lru_cache.cc @@ -234,11 +234,19 @@ void LRUCacheShard::EvictFromLRU(size_t charge, } void* LRUCacheShard::operator new(size_t size) { - return rocksdb::port::cacheline_aligned_alloc(size); + return port::cacheline_aligned_alloc(size); +} + +void* LRUCacheShard::operator new[](size_t size) { + return port::cacheline_aligned_alloc(size); } void LRUCacheShard::operator delete(void *memblock) { - rocksdb::port::cacheline_aligned_free(memblock); + port::cacheline_aligned_free(memblock); +} + +void LRUCacheShard::operator delete[](void* memblock) { + port::cacheline_aligned_free(memblock); } void LRUCacheShard::SetCapacity(size_t capacity) { diff --git a/cache/lru_cache.h b/cache/lru_cache.h index 2fd44bbce..abe78fd0c 100644 --- a/cache/lru_cache.h +++ b/cache/lru_cache.h @@ -205,8 +205,12 @@ class ALIGN_AS(CACHE_LINE_SIZE) LRUCacheShard : public CacheShard { // Overloading to aligned it to cache line size void* operator new(size_t); + void* operator new[](size_t); + void operator delete(void *); + void operator delete[](void*); + private: void LRU_Remove(LRUHandle* e); void LRU_Insert(LRUHandle* e);