Memory allocator via malloc/realloc/free with listing output. More...
#include <arccore/common/DefaultMemoryAllocator.h>
Public Member Functions | |
| AllocatedMemoryInfo | allocate (MemoryAllocationArgs args, Int64 new_size) override |
| Allocates memory for new_size bytes and returns the pointer. | |
| AllocatedMemoryInfo | reallocate (MemoryAllocationArgs args, AllocatedMemoryInfo current_ptr, Int64 new_size) override |
| Reallocates memory for new_size bytes and returns the pointer. | |
| void | deallocate (MemoryAllocationArgs args, AllocatedMemoryInfo ptr) override |
| Frees the memory whose base address is ptr. | |
| Public Member Functions inherited from Arcane::DefaultMemoryAllocator | |
| bool | hasRealloc (MemoryAllocationArgs) const override |
| Indicates whether the allocator supports realloc semantics. | |
| Int64 | adjustedCapacity (MemoryAllocationArgs, Int64 wanted_capacity, Int64 element_size) const override |
| Adjusts the capacity based on the element size. | |
| size_t | guaranteedAlignment (MemoryAllocationArgs) const override |
| Value of the alignment guaranteed by the allocator. | |
| eMemoryResource | memoryResource () const override |
| Memory resource provided by the allocator. | |
| Public Member Functions inherited from Arcane::IMemoryAllocator | |
| virtual | ~IMemoryAllocator ()=default |
| Destroys the allocator. | |
| virtual size_t | guarantedAlignment (MemoryAllocationArgs args) const |
| Value of the alignment guaranteed by the allocator. | |
| virtual void | notifyMemoryArgsChanged (MemoryAllocationArgs old_args, MemoryAllocationArgs new_args, AllocatedMemoryInfo ptr) |
| Notifies of a change in instance-specific arguments. | |
| virtual void | copyMemory (MemoryAllocationArgs args, AllocatedMemoryInfo destination, AllocatedMemoryInfo source) |
| Copies memory between two regions. | |
| virtual bool | isCollective () const |
| Indicates whether calls to the allocator must be performed collectively. | |
Memory allocator via malloc/realloc/free with listing output.
This allocator is primarily used for debugging purposes. Information output is done via std::cout.
Definition at line 62 of file DefaultMemoryAllocator.h.
|
overridevirtual |
Allocates memory for new_size bytes and returns the pointer.
The semantics are equivalent to malloc():
Reimplemented from Arcane::DefaultMemoryAllocator.
Definition at line 256 of file MemoryAllocator.cc.
References Arcane::DefaultMemoryAllocator::allocate(), and Arcane::AllocatedMemoryInfo::baseAddress().
|
overridevirtual |
Frees the memory whose base address is ptr.
The pointer ptr must have been allocated via a call to allocate() or reallocate() on this instance.
The semantics of this method are equivalent to free(), and thus ptr may be null, in which case no operation is performed.
Reimplemented from Arcane::DefaultMemoryAllocator.
Definition at line 280 of file MemoryAllocator.cc.
References Arcane::AllocatedMemoryInfo::baseAddress(), and Arcane::DefaultMemoryAllocator::deallocate().
|
overridevirtual |
Reallocates memory for new_size bytes and returns the pointer.
The pointer current_ptr must have been allocated via a call to allocate() or reallocate() on this instance.
The semantics of this method are equivalent to realloc():
Reimplemented from Arcane::DefaultMemoryAllocator.
Definition at line 267 of file MemoryAllocator.cc.
References Arcane::AllocatedMemoryInfo::baseAddress(), and Arcane::DefaultMemoryAllocator::reallocate().