cvmfs/sqlitemem.cc
void *SqliteMemoryManager::MallocArena::Malloc(const uint32_t size) {
  assert(size > 0);

  // Control word first, block type tag last
  int32_t total_size = sizeof(ReservedBlockCtl) + size + 1;
  total_size = RoundUp8(total_size);
  if (total_size < kMinBlockSize)
    total_size = kMinBlockSize;

  AvailBlockCtl *p = FindAvailBlock(total_size);
  if (p == NULL)
    return NULL;

  no_reserved_++;
  return ReserveBlock(p, total_size);
}
/**
 * Walks the list of available blocks starting from rover and allocates the
 * first available spot that's large enough.  Puts the reserved block at the end
 * of the available one and, if necessary, removes the available one from the
 * list of free blocks.
 */
Walks the list of available blocks starting from rover and allocates the
first available spot that's large enough.  Puts the reserved block at the end
of the available one and, if necessary, removes the available one from the
list of free blocks.
Walks the list of available blocks starting from rover and allocates the first available spot that ' s large enough . Puts the reserved block at the end of the available one and if necessary removes the available one from the list of free blocks .
void *SqliteMemoryManager::MallocArena::Malloc(const uint32_t size) {
  assert(size > 0);
  int32_t total_size = sizeof(ReservedBlockCtl) + size + 1;
  total_size = RoundUp8(total_size);
  if (total_size < kMinBlockSize)
    total_size = kMinBlockSize;
  AvailBlockCtl *p = FindAvailBlock(total_size);
  if (p == NULL)
    return NULL;
  no_reserved_++;
  return ReserveBlock(p, total_size);
}
void * SqliteMemoryManager :: MallocArena :: Malloc ( const uint32_t size ) { assert ( size > 0 ) ; int32_t total_size = sizeof ( ReservedBlockCtl ) + size + 1 ; total_size = RoundUp8 ( total_size ) ; if ( total_size < kMinBlockSize ) total_size = kMinBlockSize ; AvailBlockCtl * p = FindAvailBlock ( total_size ) ; if ( p == NULL ) return NULL ; no_reserved_ ++ ; return ReserveBlock ( p , total_size ) ; }
Walks the list of available blocks starting from rover and allocates the
 first available spot that's large enough.
Walks the list of available blocks starting from rover and allocates the first available spot that ' s large enough .
// Control word first, block type tag last