17 void* ptr = malloc(size);
19 throw std::bad_alloc();
22 allocated_size_ += size;
34 if (size > allocated_size_) {
36 <<
"; currently allocated size: " << allocated_size_);
39 allocated_size_ -= size;
45 return (allocated_size_ == 0 && named_addrs_.empty());
50 std::map<std::string, void*>::const_iterator found =
51 named_addrs_.find(name);
52 if (found != named_addrs_.end()) {
60 named_addrs_[name] = addr;
66 const size_t n_erased = named_addrs_.erase(name);
67 return (n_erased != 0);
A generic exception that is thrown if a parameter given to a method would refer to or modify out-of-r...
virtual bool setNamedAddressImpl(const char *name, void *addr)
Local segment version of setNamedAddress.
virtual bool clearNamedAddressImpl(const char *name)
Local segment version of clearNamedAddress.
virtual void * allocate(size_t size)
Allocate/acquire a segment of memory.
virtual bool allMemoryDeallocated() const
Check if all allocated memory was deallocated.
virtual NamedAddressResult getNamedAddressImpl(const char *name) const
Local segment version of getNamedAddress.
virtual void deallocate(void *ptr, size_t size)
Free/release a segment of memory.
std::pair< bool, void * > NamedAddressResult
Type definition for result returned by getNamedAddress()
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
Defines the logger used by the top-level component of kea-lfc.