Kea 2.7.6
|
malloc/free based Memory Segment class More...
#include <memory_segment_local.h>
Public Member Functions | |
MemorySegmentLocal () | |
Constructor. | |
virtual | ~MemorySegmentLocal () |
Destructor. | |
virtual bool | allMemoryDeallocated () const |
Check if all allocated memory was deallocated. | |
virtual void * | allocate (size_t size) |
Allocate/acquire a segment of memory. | |
virtual bool | clearNamedAddressImpl (const char *name) |
Local segment version of clearNamedAddress. | |
virtual void | deallocate (void *ptr, size_t size) |
Free/release a segment of memory. | |
virtual NamedAddressResult | getNamedAddressImpl (const char *name) const |
Local segment version of getNamedAddress. | |
virtual bool | setNamedAddressImpl (const char *name, void *addr) |
Local segment version of setNamedAddress. | |
Public Member Functions inherited from isc::util::MemorySegment | |
virtual | ~MemorySegment () |
Destructor. | |
bool | clearNamedAddress (const char *name) |
Delete a name previously associated with a segment address. | |
NamedAddressResult | getNamedAddress (const char *name) const |
Return the address in the segment that has the given name. | |
bool | setNamedAddress (const char *name, void *addr) |
Associate specified address in the segment with a given name. | |
Additional Inherited Members | |
Public Types inherited from isc::util::MemorySegment | |
typedef std::pair< bool, void * > | NamedAddressResult |
Type definition for result returned by getNamedAddress() | |
Protected Member Functions inherited from isc::util::MemorySegment |
malloc/free based Memory Segment class
This class specifies a concrete implementation for a malloc/free based MemorySegment. Please see the MemorySegment class documentation for usage.
Definition at line 23 of file memory_segment_local.h.
|
inline |
Constructor.
Creates a local memory segment object
Definition at line 28 of file memory_segment_local.h.
|
inlinevirtual |
Destructor.
Definition at line 32 of file memory_segment_local.h.
|
virtual |
Check if all allocated memory was deallocated.
true
if all allocated memory was deallocated, false
otherwise. Implements isc::util::MemorySegment.
Definition at line 44 of file memory_segment_local.cc.
|
virtual |
Allocate/acquire a segment of memory.
The source of the memory is libc's malloc().
Throws std::bad_alloc
if the implementation cannot allocate the requested storage.
size | The size of the memory requested in bytes. |
Implements isc::util::MemorySegment.
Definition at line 16 of file memory_segment_local.cc.
|
virtual |
Local segment version of clearNamedAddress.
There's a small chance this method could throw std::bad_alloc. It should be considered a fatal error.
Implements isc::util::MemorySegment.
Definition at line 65 of file memory_segment_local.cc.
|
virtual |
Free/release a segment of memory.
This method may throw isc::OutOfRange
if size
is not equal to the originally allocated size.
ptr | Pointer to the block of memory to free/release. This should be equal to a value returned by allocate() . |
size | The size of the memory to be freed in bytes. This should be equal to the number of bytes originally allocated. |
Implements isc::util::MemorySegment.
Definition at line 27 of file memory_segment_local.cc.
References isc_throw.
|
virtual |
Local segment version of getNamedAddress.
There's a small chance this method could throw std::bad_alloc. It should be considered a fatal error.
Implements isc::util::MemorySegment.
Definition at line 49 of file memory_segment_local.cc.
|
virtual |
Local segment version of setNamedAddress.
This version does not validate the given address to see whether it belongs to this segment.
This implementation of this method always returns false
(but the application should expect a return value of true
unless it knows the memory segment class is MemorySegmentLocal
and needs to exploit the fact).
Implements isc::util::MemorySegment.
Definition at line 59 of file memory_segment_local.cc.