Logo Search packages:      
Sourcecode: maxdb-7.5.00 version File versions

void LVCMem_BlockAllocator::Deallocate ( void *  p,
SAPDB_ULong  BlockCount 
) [virtual]

Frees the memory.

None of the objects in the memory block will be deinitialised by this call. The size argument must match the value passed to 'allocate' to obtain this memory. The pointer argument must not be null. On failure, an exception is thrown.

Parameters:
p [ in ] the pointer returned by a previous allocate call.
BlockCount [ in ] Number of blocks (NOT bytes!) to deallocate.

Implements SAPDBMem_IBlockAllocator.

Definition at line 145 of file LVCMem_BlockAllocator.cpp.

References SAPDBMem_IBlockAllocator::Deallocate(), m_allocated, m_allocator, m_CountBaseDealloc, m_CountDealloc, m_defaultBlockCount, m_firstFree, m_limit, and m_spinlock.

{
#ifdef SAPDBMem_USE_SYSTEM_ALLOC
  if (p) free(p);
#else
  RTESync_LockedScope lockedScope(m_spinlock);
  ++m_CountDealloc;
  if ((BlockCount == m_defaultBlockCount) && (m_allocated <= m_limit))
  {
    NextPointer* pBlock = REINTERPRET_CAST(NextPointer*, p);
    pBlock->m_next = m_firstFree;
    m_firstFree = pBlock;
  }
  else
  {
    m_allocator.Deallocate(p, BlockCount);
      ++m_CountBaseDealloc;
    m_allocated -= BlockCount;
  }
#endif
}


Generated by  Doxygen 1.6.0   Back to index