If we throw an exception from the constructor, destructor is not called.
Call the clean-up manually there, so we don't leak memory.
holder_name_(getNextHolderName()), holding_(true)
{
if (mem_sgmt_.setNamedAddress(holder_name_.c_str(), NULL)) {
+ // OK. We've grown. The caller might need to be informed, so
+ // we throw. But then, we don't get our destructor, so we
+ // release the memory right away.
+ mem_sgmt_.clearNamedAddress(holder_name_.c_str());
isc_throw(isc::util::MemorySegmentGrown,
"Segment grown when allocating holder");
}