artefaktur
software engineer &        architecture

 
 
 
 

class ObjectHeap

Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members   Related Pages  

acdk::lang::sys::ObjectHeap Class Reference

#include <ObjectHeap.h>

List of all members.


Public Types

enum  HeapType {
  RC_Heap = 0x0001, RC_GC_Heap = 0x0002, PA_Heap = 0x0004, GC_Heap = 0x0008,
  Garbage_Heap = 0x0010, Private_Heap = 0x0020
}
 HeapType declares the Type of heap, with different memory management strategies. More...


Public Member Functions

AllocatorstaticAllocator ()
 return the allocator configured to allocate static objects


Static Public Member Functions

Allocatorallocator ()
 returns the current allocator

bool notifyBeforeObjectDestruction (Object *obj)
 called if RefCount is zero.

void notifyWhileObjectDestruction (Object *obj)
 will be called after finalize but bufore ~acdk::lang::Object

void listHeaps (::acdk::lang::ref::NotifyObjectEventListener *listener, bool allthreads)
void listObjects (::acdk::lang::ref::NotifyObjectEventListener *listener, int flags)
void listedAllocated (::acdk::lang::ref::NotifyObjectEventListener *listener, int flags, AllocatedType type)
int objectCount (bool total=false)
 returns the count of allocated Object in current or all Heaps If the current Heap has no tracking, returns 0.

size_t totalAllocated (bool total=false)
 returns the allocated Memory in current or all Heaps.

bool gc (bool total=false)
 try to free Object References, which has no external References.

void newHeapObject (Object *obj)
 register this object as new dynamically allocated object

bool onHeapAllocated (Object *obj)
 looks if given Object is in the current heap

void pushFrame (HeapType heaptype=RC_GC_Heap, HeapInfo info=HeapIsThread, const char *name=)
 creates a new HeapFrame

void popFrame (HeapInfo info=HeapIsThread)
 destroys the the top (last pushed) Heap

void pushFrame (RHeapFrame heap)
 Make the given HeapFrame as top active HeapFrame.

bool deleteFrame (const char *name)
 destroys the frame, take care, this can have side effects

RHeapFrame topHeapFrame ()
 returns the last pushed frame

RHeapFrame globalHeap ()
 The which holds globals (not bound to Thread.

RHeapFrame staticHeap ()
 The which hold the statics.

RHeapFrame getStaticFrame ()
 The which hold the statics.

RHeapFrame getThreadLocalHeap ()
 used to allocate ThreadLocal

AllocatorgetThreadLocalAllocator ()
 return the allocator specific to this thread

ObjectnewStaticObject (Object *object)
 Registers the object as an static instance.

void registerStaticReference (RObject *reference)
 register the an reference to Object as an static/global reference.

void registerStaticReference (Object *reference)
 register the an reference to Object as an static/global reference.

void clearAllStaticReferences ()
 clear all via registerStaticReference registered reference (set to Nil).

bool isStaticReferenceObject (Object *obj)
 return true if the given object instance is held by a static reference

void lockHeap ()
 locks the ObjectHeap interface

void unlockHeap ()
void removeThreadHeap ()
 removes the heaps connected with the current Thread

unsigned int stackBase ()
 return the adress of the stack base pointer

void saveStackBase (unsigned int sp)
jlong getMaxMemoryUsage ()
 return the overal limit of memory usage

void setMaxMemoryUsage (jlong maxmem)
 set the overall limit of memory usage

jlong getThreadMaxMemoryUsage ()
 return the limit of memory usage inside this thread

void setThreadMaxMemoryUsage (jlong maxmem)
jlongthreadMaxMemoryUsage ()
jlongmaxMemoryUsage ()
jlongcurMemUsage ()
jlongcurThreadMemUsage ()
jlong getMaxAllocatedMem ()

Static Protected Member Functions

bool _onHeapAllocated (const Object *obj)
 unsynchronized version

Object_newStaticObject (Object *obj)
 unsynchronized version


Private Member Functions

 ObjectHeap ()
 private constructor. This class is static


Member Enumeration Documentation

enum acdk::lang::sys::ObjectHeap::HeapType
 

HeapType declares the Type of heap, with different memory management strategies.

Enumeration values:
RC_Heap  Objects are reference counted, but no bookkeeping of References will be made.

Cyclic references will not be resolved and freed at gc(). gc() does nothing.

RC_GC_Heap  Objects are reference counted and collected in the Heap.

gc() will try to free cyclic references

PA_Heap  Use a seperate PageAllocator with mark/sweep algo.
GC_Heap  using Boehms Conservative Garbage Collector
Garbage_Heap  Objects are allocated on the heap, no reference counting, no bookkeeping of references, just allocate and forget.

garantee of memory leeks.

Private_Heap 

Constructor & Destructor Documentation

acdk::lang::sys::ObjectHeap::ObjectHeap  )  [inline, private]
 

private constructor. This class is static


Member Function Documentation

Object* acdk::lang::sys::ObjectHeap::_newStaticObject Object obj  )  [static, protected]
 

unsynchronized version

bool acdk::lang::sys::ObjectHeap::_onHeapAllocated const Object obj  )  [static, protected]
 

unsynchronized version

Allocator* acdk::lang::sys::ObjectHeap::allocator  )  [static]
 

returns the current allocator

void acdk::lang::sys::ObjectHeap::clearAllStaticReferences  )  [static]
 

clear all via registerStaticReference registered reference (set to Nil).

Calling this method is maybe dangerous, if other parts of the applications rely on these static variables

jlong& acdk::lang::sys::ObjectHeap::curMemUsage  )  [static]
 

jlong& acdk::lang::sys::ObjectHeap::curThreadMemUsage  )  [static]
 

bool acdk::lang::sys::ObjectHeap::deleteFrame const char *  name  )  [static]
 

destroys the frame, take care, this can have side effects

Parameters:
the name of the heapframe.
Returns:
true if frame is deleted

bool acdk::lang::sys::ObjectHeap::gc bool  total = false  )  [static]
 

try to free Object References, which has no external References.

Returns:
returns true, if an Reference island was found

jlong acdk::lang::sys::ObjectHeap::getMaxAllocatedMem  )  [inline, static]
 

jlong acdk::lang::sys::ObjectHeap::getMaxMemoryUsage  )  [inline, static]
 

return the overal limit of memory usage

RHeapFrame acdk::lang::sys::ObjectHeap::getStaticFrame  )  [inline, static]
 

The which hold the statics.

Deprecated:

Allocator* acdk::lang::sys::ObjectHeap::getThreadLocalAllocator  )  [static]
 

return the allocator specific to this thread

RHeapFrame acdk::lang::sys::ObjectHeap::getThreadLocalHeap  )  [static]
 

used to allocate ThreadLocal

jlong acdk::lang::sys::ObjectHeap::getThreadMaxMemoryUsage  )  [inline, static]
 

return the limit of memory usage inside this thread

RHeapFrame acdk::lang::sys::ObjectHeap::globalHeap  )  [static]
 

The which holds globals (not bound to Thread.

bool acdk::lang::sys::ObjectHeap::isStaticReferenceObject Object obj  )  [static]
 

return true if the given object instance is held by a static reference

void acdk::lang::sys::ObjectHeap::listedAllocated ::acdk::lang::ref::NotifyObjectEventListener listener,
int  flags,
AllocatedType  type
[static]
 

void acdk::lang::sys::ObjectHeap::listHeaps ::acdk::lang::ref::NotifyObjectEventListener listener,
bool  allthreads
[static]
 

void acdk::lang::sys::ObjectHeap::listObjects ::acdk::lang::ref::NotifyObjectEventListener listener,
int  flags
[static]
 

void acdk::lang::sys::ObjectHeap::lockHeap  )  [static]
 

locks the ObjectHeap interface

jlong& acdk::lang::sys::ObjectHeap::maxMemoryUsage  )  [static]
 

void acdk::lang::sys::ObjectHeap::newHeapObject Object obj  )  [static]
 

register this object as new dynamically allocated object

Object* acdk::lang::sys::ObjectHeap::newStaticObject Object object  )  [static]
 

Registers the object as an static instance.

Normally you dont need to call this function by hand, but use registerStaticReference().

Parameters:
object the Object, which will be stored in a static/global reference

bool acdk::lang::sys::ObjectHeap::notifyBeforeObjectDestruction Object obj  )  [static]
 

called if RefCount is zero.

Returns:
true if Object should be destroyed

void acdk::lang::sys::ObjectHeap::notifyWhileObjectDestruction Object obj  )  [static]
 

will be called after finalize but bufore ~acdk::lang::Object

int acdk::lang::sys::ObjectHeap::objectCount bool  total = false  )  [static]
 

returns the count of allocated Object in current or all Heaps If the current Heap has no tracking, returns 0.

bool acdk::lang::sys::ObjectHeap::onHeapAllocated Object obj  )  [static]
 

looks if given Object is in the current heap

void acdk::lang::sys::ObjectHeap::popFrame HeapInfo  info = HeapIsThread  )  [static]
 

destroys the the top (last pushed) Heap

void acdk::lang::sys::ObjectHeap::pushFrame RHeapFrame  heap  )  [static]
 

Make the given HeapFrame as top active HeapFrame.

void acdk::lang::sys::ObjectHeap::pushFrame HeapType  heaptype = RC_GC_Heap,
HeapInfo  info = HeapIsThread,
const char *  name =
[static]
 

creates a new HeapFrame

Parameters:
heaptype the type of the heap RC_Heap Objects are reference counted, but no bookkeeping of References will be made. Cyclic references will not be resolved and freed at gc(). gc() does nothing.
RC_GC_Heap Objects are reference counted and collected in the Heap. gc() will try to free cyclic references

Garbage_Heap Objects are allocated on the heap, no reference counting, maybe no bookkeeping of references. on popFrame() all Objects will be freed. Please take care of dangling pointers!

Parameters:
name the name of the heap. Used for debugging purpose or as identifier to delete them.

void acdk::lang::sys::ObjectHeap::registerStaticReference Object reference  )  [static]
 

register the an reference to Object as an static/global reference.

Will call releaseRef() at at end of program

void acdk::lang::sys::ObjectHeap::registerStaticReference RObject reference  )  [static]
 

register the an reference to Object as an static/global reference.

This reference can be reset clearAllStaticReferences().

Parameters:
reference the Reference to the Object.

void acdk::lang::sys::ObjectHeap::removeThreadHeap  )  [static]
 

removes the heaps connected with the current Thread

void acdk::lang::sys::ObjectHeap::saveStackBase unsigned int  sp  )  [static]
 

void acdk::lang::sys::ObjectHeap::setMaxMemoryUsage jlong  maxmem  )  [inline, static]
 

set the overall limit of memory usage

void acdk::lang::sys::ObjectHeap::setThreadMaxMemoryUsage jlong  maxmem  )  [inline, static]
 

unsigned int acdk::lang::sys::ObjectHeap::stackBase  )  [static]
 

return the adress of the stack base pointer

Allocator* acdk::lang::sys::ObjectHeap::staticAllocator  )  [inline]
 

return the allocator configured to allocate static objects

RHeapFrame acdk::lang::sys::ObjectHeap::staticHeap  )  [static]
 

The which hold the statics.

Deprecated:

jlong& acdk::lang::sys::ObjectHeap::threadMaxMemoryUsage  )  [static]
 

RHeapFrame acdk::lang::sys::ObjectHeap::topHeapFrame  )  [static]
 

returns the last pushed frame

size_t acdk::lang::sys::ObjectHeap::totalAllocated bool  total = false  )  [static]
 

returns the allocated Memory in current or all Heaps.

If the current Heap has no tracking, returns 0.

void acdk::lang::sys::ObjectHeap::unlockHeap  )  [static]
 

 
Last modified 2005-05-08 18:32 by SYSTEM By Artefaktur, Ing. Bureau Kommer