18 #ifndef FOEDUS_MEMORY_ALIGNED_MEMORY_HPP_
19 #define FOEDUS_MEMORY_ALIGNED_MEMORY_HPP_
126 #ifndef DISABLE_CXX11_IN_PUBLIC_HEADERS
135 #endif // DISABLE_CXX11_IN_PUBLIC_HEADERS
147 void alloc_onnode(uint64_t size, uint64_t alignment,
int numa_node) CXX11_NOEXCEPT {
163 uint64_t required_size,
164 double expand_margin = 2.0,
165 bool retain_content =
false) CXX11_NOEXCEPT;
251 #endif // FOEDUS_MEMORY_ALIGNED_MEMORY_HPP_
numa_alloc_onnode() and numa_free().
#define CXX11_NULLPTR
Used in public headers in place of "nullptr" of C++11.
uint64_t get_alignment() const
Returns the alignment of the memory block.
uint64_t count_
Byte count of this slice in memory_.
void release_block()
Releases the memory block.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
AlignedMemory & operator=(const AlignedMemory &other)=delete
AlignedMemorySlice()
Empty constructor.
#define CXX11_NOEXCEPT
Used in public headers in place of "noexcept" of C++11.
AlignedMemory * memory_
The wrapped memory.
AllocType
Type of new/delete operation for the block.
friend std::ostream & operator<<(std::ostream &o, const AlignedMemory &v)
~AlignedMemory()
Automatically releases the memory.
ErrorCode assure_capacity(uint64_t required_size, double expand_margin=2.0, bool retain_content=false) noexcept
If the current size is smaller than the given size, automatically expands.
void alloc(uint64_t size, uint64_t alignment, AllocType alloc_type, int numa_node) noexcept
Allocate a memory, releasing the current memory if exists.
AllocType get_alloc_type() const
Returns type of new/delete operation for the block.
AlignedMemorySlice(const AlignedMemorySlice &slice, uint64_t offset, uint64_t count)
A slice that covers the specified region of another slice.
#define CXX11_FINAL
Used in public headers in place of "final" of C++11.
uint64_t get_size() const
A slice of foedus::memory::AlignedMemory.
void * get_block() const
Returns the memory block.
uint64_t get_size() const
Returns the byte size of the memory block.
#define CXX11_FUNC_DELETE
Used in public headers in place of " = delete" of C++11.
uint64_t offset_
Byte offset of this slice in memory_.
friend std::ostream & operator<<(std::ostream &o, const AlignedMemorySlice &v)
Represents one memory block aligned to actual OS/hardware pages.
AlignedMemorySlice(AlignedMemory *memory)
A dummy slice that covers the memory entirely.
posix_memalign() and free().
#define ASSERT_ND(x)
A warning-free wrapper macro of assert() that has no performance effect in release mode even when 'x'...
numa_alloc_interleaved() and numa_free().
bool is_1gb_hugepage_enabled()
Returns if 1GB hugepages were enabled.
void alloc_onnode(uint64_t size, uint64_t alignment, int numa_node) noexcept
Short for alloc(kNumaAllocOnnode)
ErrorCode
Enum of error codes defined in error_code.xmacro.
int get_numa_node() const
If alloc_type_ is kNumaAllocOnnode, returns the NUMA node this memory was allocated at...
AlignedMemory() noexcept
Empty constructor which allocates nothing.
AlignedMemorySlice(AlignedMemory *memory, uint64_t offset, uint64_t count)
A slice that covers the specified region of the memory.
bool is_null() const
Returns if this object doesn't hold a valid memory block.