MeixnerGC  1.0
gc_object Class Reference

#include <gc_ptr.h>

Public Member Functions

 gc_object () noexcept
 
 gc_object (void *e, void(*d)(void *, void *)) noexcept
 
 ~gc_object ()
 

Protected Member Functions

void * start () noexcept
 
void * end () noexcept
 

Protected Attributes

void * end_
 
void(* destructor )(void *s, void *e)
 
std::atomic< int > root_ref_cnt
 
std::atomic< gc_base_ptr * > first
 
bool mark
 

Friends

template<class T >
class make_gc
 
class gc_base_ptr
 
void gc_collect ()
 

Detailed Description

GC memory control object. All allocations are handled via gc_object and C++ objects are constructed within them

Constructor & Destructor Documentation

gc_object::gc_object ( )
noexcept

constructor

gc_object::gc_object ( void *  e,
void(*)(void *, void *)  d 
)
noexcept

constructor

Parameters
[in]e
[in]ddestructor callback
gc_object::~gc_object ( )

destructor

Member Function Documentation

void* gc_object::end ( )
inlineprotectednoexcept

determine the end address of the last contaned C++ object belonging to this allocation

Returns
end address after last contained object.
void* gc_object::start ( )
inlineprotectednoexcept

determine the start address of the first contained C++ object belonging to this allocation: It starts after the control information contained in gc_object, i.e. the layout in memory is as follows: <gc_obj><C++ object>[<C++ object> ....]

Returns
start address of first contained object.

Friends And Related Function Documentation

void gc_collect ( )
friend

manually trigger garbage collection. Normally this is not required as the collection starts automatically. It may be useful in low-memory situations to force a garbage collection.

Member Data Documentation

void(* gc_object::destructor) (void *s, void *e)
protected

destructor callback that destructs the contained elements.

Parameters
[in]sstart address
[in]eend addresses
void* gc_object::end_
protected

End of the memory range allocated by this object

std::atomic<gc_base_ptr *> gc_object::first
protected

pointer to first contained gc_ptr<> within this object

bool gc_object::mark
protected

flag for mark-sweek algorithm

std::atomic<int> gc_object::root_ref_cnt
protected

number of pointers from the root set that point to this object


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