CernVM-FS  2.12.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ItemAllocator Class Reference

#include <item_mem.h>

Public Member Functions

 ItemAllocator ()
 
 ~ItemAllocator ()
 
void * Malloc (unsigned size)
 
void Free (void *ptr)
 

Static Public Member Functions

static int64_t total_allocated ()
 

Private Attributes

std::vector< MallocArena * > malloc_arenas_
 
unsigned idx_last_arena_
 
pthread_mutex_t lock_
 

Static Private Attributes

static const unsigned kArenaSize = 128 * 1024 * 1024
 
static atomic_int64 total_allocated_ = 0
 

Detailed Description

This file is part of the CernVM File System. To avoid memory fragmentation, allocate the data buffer inside the BlockItem with a separate allocator.

Definition at line 20 of file item_mem.h.

Constructor & Destructor Documentation

ItemAllocator::ItemAllocator ( )

Definition at line 37 of file item_mem.cc.

Here is the call graph for this function:

ItemAllocator::~ItemAllocator ( )

Definition at line 46 of file item_mem.cc.

Member Function Documentation

void ItemAllocator::Free ( void *  ptr)

Definition at line 16 of file item_mem.cc.

Referenced by BlockItem::Reset(), and BlockItem::~BlockItem().

Here is the call graph for this function:

Here is the caller graph for this function:

void * ItemAllocator::Malloc ( unsigned  size)

Definition at line 55 of file item_mem.cc.

Referenced by BlockItem::MakeData(), and BlockItem::MakeDataCopy().

Here is the call graph for this function:

Here is the caller graph for this function:

static int64_t ItemAllocator::total_allocated ( )
inlinestatic

Definition at line 28 of file item_mem.h.

Member Data Documentation

unsigned ItemAllocator::idx_last_arena_
private

Where the last successful allocation took place.

Definition at line 38 of file item_mem.h.

Referenced by Free(), and Malloc().

const unsigned ItemAllocator::kArenaSize = 128 * 1024 * 1024
staticprivate

Definition at line 31 of file item_mem.h.

Referenced by Free(), ItemAllocator(), Malloc(), and ~ItemAllocator().

pthread_mutex_t ItemAllocator::lock_
private

Definition at line 39 of file item_mem.h.

Referenced by Free(), ItemAllocator(), Malloc(), and ~ItemAllocator().

std::vector<MallocArena *> ItemAllocator::malloc_arenas_
private

Definition at line 34 of file item_mem.h.

Referenced by Free(), ItemAllocator(), Malloc(), and ~ItemAllocator().

atomic_int64 ItemAllocator::total_allocated_ = 0
staticprivate

This file is part of the CernVM File System.

Definition at line 32 of file item_mem.h.

Referenced by Free(), ItemAllocator(), Malloc(), total_allocated(), and ~ItemAllocator().


The documentation for this class was generated from the following files: