ns-3 Direct Code Execution
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
KingsleyAlloc Class Reference

#include <kingsley-alloc.h>

+ Collaboration diagram for KingsleyAlloc:

Classes

struct  Available
struct  Mmap
struct  MmapChunk

Public Member Functions

 KingsleyAlloc (void)
 ~KingsleyAlloc ()
KingsleyAllocClone (void)
void Dispose ()
void Free (uint8_t *buffer, uint32_t size)
uint8_t * Malloc (uint32_t size)
uint8_t * Realloc (uint8_t *oldBuffer, uint32_t oldSize, uint32_t newSize)
void SwitchTo (void)

Private Member Functions

uint8_t * Brk (uint32_t needed)
uint32_t BucketToSize (uint8_t bucket)
void MmapAlloc (uint32_t size)
void MmapFree (uint8_t *buffer, uint32_t size)
uint8_t SizeToBucket (uint32_t size)

Private Attributes

struct Availablem_buckets [32]
std::list< struct
KingsleyAlloc::MmapChunk
m_chunks
uint32_t m_defaultMmapSize

Detailed Description

Definition at line 7 of file kingsley-alloc.h.

Constructor & Destructor Documentation

KingsleyAlloc::KingsleyAlloc ( void  )

Definition at line 29 of file kingsley-alloc.cc.

References m_buckets.

Referenced by Clone().

+ Here is the caller graph for this function:

KingsleyAlloc::~KingsleyAlloc ( )

Definition at line 35 of file kingsley-alloc.cc.

References m_chunks, and MmapFree().

+ Here is the call graph for this function:

Member Function Documentation

uint8_t * KingsleyAlloc::Brk ( uint32_t  needed)
private

Definition at line 166 of file kingsley-alloc.cc.

References m_chunks, m_defaultMmapSize, and MmapAlloc().

Referenced by Malloc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t KingsleyAlloc::BucketToSize ( uint8_t  bucket)
private

Definition at line 203 of file kingsley-alloc.cc.

Referenced by Malloc(), and SizeToBucket().

+ Here is the caller graph for this function:

KingsleyAlloc * KingsleyAlloc::Clone ( void  )

Definition at line 84 of file kingsley-alloc.cc.

References KingsleyAlloc::Mmap::buffer, KingsleyAlloc::MmapChunk::copy, KingsleyAlloc::Mmap::current, KingsleyAlloc(), m_buckets, m_chunks, KingsleyAlloc::MmapChunk::mmap, KingsleyAlloc::Mmap::refcount, and KingsleyAlloc::Mmap::size.

Referenced by ns3::DceManager::Clone().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void KingsleyAlloc::Dispose ( )

Definition at line 70 of file kingsley-alloc.cc.

References m_chunks.

Referenced by ns3::DceManager::DeleteProcess(), and ns3::DceManager::Execve().

+ Here is the caller graph for this function:

void KingsleyAlloc::Free ( uint8_t *  buffer,
uint32_t  size 
)

Definition at line 241 of file kingsley-alloc.cc.

References m_buckets, m_chunks, m_defaultMmapSize, MmapFree(), KingsleyAlloc::Available::next, REPORT_FREE, and SizeToBucket().

Referenced by Realloc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint8_t * KingsleyAlloc::Malloc ( uint32_t  size)

Definition at line 210 of file kingsley-alloc.cc.

References Brk(), BucketToSize(), m_buckets, m_defaultMmapSize, MARK_DEFINED, MARK_UNDEFINED, MmapAlloc(), KingsleyAlloc::Available::next, REPORT_MALLOC, and SizeToBucket().

Referenced by Realloc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void KingsleyAlloc::MmapAlloc ( uint32_t  size)
private
void KingsleyAlloc::MmapFree ( uint8_t *  buffer,
uint32_t  size 
)
private

Definition at line 137 of file kingsley-alloc.cc.

Referenced by Free(), and ~KingsleyAlloc().

+ Here is the caller graph for this function:

uint8_t * KingsleyAlloc::Realloc ( uint8_t *  oldBuffer,
uint32_t  oldSize,
uint32_t  newSize 
)

Definition at line 271 of file kingsley-alloc.cc.

References Free(), and Malloc().

+ Here is the call graph for this function:

uint8_t KingsleyAlloc::SizeToBucket ( uint32_t  size)
private

Definition at line 186 of file kingsley-alloc.cc.

References BucketToSize().

Referenced by Free(), and Malloc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void KingsleyAlloc::SwitchTo ( void  )

Member Data Documentation

struct Available* KingsleyAlloc::m_buckets[32]
private

Definition at line 51 of file kingsley-alloc.h.

Referenced by Clone(), Free(), KingsleyAlloc(), and Malloc().

std::list<struct KingsleyAlloc::MmapChunk> KingsleyAlloc::m_chunks
private

Definition at line 50 of file kingsley-alloc.h.

Referenced by Brk(), Clone(), Dispose(), Free(), MmapAlloc(), SwitchTo(), and ~KingsleyAlloc().

uint32_t KingsleyAlloc::m_defaultMmapSize
private

Definition at line 52 of file kingsley-alloc.h.

Referenced by Brk(), Free(), and Malloc().


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