本文整理汇总了C++中MemoryManager::deallocate方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryManager::deallocate方法的具体用法?C++ MemoryManager::deallocate怎么用?C++ MemoryManager::deallocate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryManager
的用法示例。
在下文中一共展示了MemoryManager::deallocate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: XalanDestroy
void
XalanDestroy(
MemoryManager& theMemoryManager,
Type& theArg)
{
XalanDestroy(theArg);
theMemoryManager.deallocate(&theArg);
}
示例2: delete
void XMemory::operator delete(void* p, MemoryManager* manager)
{
assert(manager != 0);
if (p != 0)
{
size_t headerSize = XMLPlatformUtils::alignPointerForNewBlockAllocation(sizeof(MemoryManager*));
void* const block = (char*)p - headerSize;
/***
* assert(*(MemoryManager**)block == manager);
*
* NOTE: for compiler which can't properly trace the memory manager used in the
* placement new, we use the memory manager embedded in the memory rather
* than the one passed in
*/
MemoryManager* pM = *(MemoryManager**)block;
pM->deallocate(block);
}
}
示例3: getCanonicalRepresentation
/***
* 2.5.1.2 List datatypes
*
* The canonical-lexical-representation for the ·list· datatype is defined as
* the lexical form in which each item in the ·list· has the canonical
* lexical representation of its ·itemType·.
***/
const XMLCh* ListDatatypeValidator::getCanonicalRepresentation(const XMLCh* const rawData
, MemoryManager* const memMgr
, bool toValidate) const
{
MemoryManager* toUse = memMgr? memMgr : getMemoryManager();
ListDatatypeValidator* temp = (ListDatatypeValidator*) this;
temp->setContent(rawData);
BaseRefVectorOf<XMLCh>* tokenVector = XMLString::tokenizeString(rawData, toUse);
Janitor<BaseRefVectorOf<XMLCh> > janName(tokenVector);
if (toValidate)
{
try
{
temp->checkContent(tokenVector, rawData, 0, false, toUse);
}
catch (...)
{
return 0;
}
}
unsigned int retBufSize = 2 * XMLString::stringLen(rawData);
XMLCh* retBuf = (XMLCh*) toUse->allocate(retBufSize * sizeof(XMLCh));
retBuf[0] = 0;
XMLCh* retBufPtr = retBuf;
DatatypeValidator* itemDv = this->getItemTypeDTV();
try
{
for (unsigned int i = 0; i < tokenVector->size(); i++)
{
XMLCh* itemCanRep = (XMLCh*) itemDv->getCanonicalRepresentation(tokenVector->elementAt(i), toUse, false);
unsigned int itemLen = XMLString::stringLen(itemCanRep);
if(retBufPtr+itemLen+2 >= retBuf+retBufSize)
{
// need to resize
XMLCh * oldBuf = retBuf;
retBuf = (XMLCh*) toUse->allocate(retBufSize * sizeof(XMLCh) * 4);
memcpy(retBuf, oldBuf, retBufSize * sizeof(XMLCh ));
retBufPtr = (retBufPtr - oldBuf) + retBuf;
toUse->deallocate(oldBuf);
retBufSize <<= 2;
}
XMLString::catString(retBufPtr, itemCanRep);
retBufPtr = retBufPtr + itemLen + 1;
*(retBufPtr++) = chSpace;
*(retBufPtr) = chNull;
toUse->deallocate(itemCanRep);
}
return retBuf;
}
catch (...)
{
return 0;
}
}
示例4: cleanUp
inline void ContentLeafNameTypeVector::cleanUp()
{
fMemoryManager->deallocate(fLeafNames); //delete [] fLeafNames;
fMemoryManager->deallocate(fLeafTypes); //delete [] fLeafTypes;
}