Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ThingReferences Namespace Reference

The ThingReferences namespace contains functions relating to the memory management system in Centum. More...


Functions

CENTUMSHAREDCODE_API void AddCThingReference (CThing *thing)
 Increases the reference count of a CThing object.
CENTUMSHAREDCODE_API void AddDefReference (CDefinition *def)
 Increases the reference count of a CDefinition object.
CENTUMSHAREDCODE_API void ReleaseCThing (CThing *thing)
 Decrements the reference count of a CThing object and releases its memory if appropriate.
CENTUMSHAREDCODE_API void ReleaseCDefinition (CDefinition *def)
 Decrements the reference count of a CDefinition object and releases its memory if appropriate.
CENTUMSHAREDCODE_API void AddCThingReferenceGC (CThing *thing, CThing *from)
 Increases the reference count of a CThing object and adds a backtrace pointer for garbage collection.
CENTUMSHAREDCODE_API void ReleaseCThingGC (CThing *thing, CThing *from)
 Removes the appropriate back-pointer fromt the CThing parameter and decrements its reference count, releasing it if appropriate.
CENTUMSHAREDCODE_API void GarbageCollect (CThing *thing)
 Traces through the back-pointers stored in a thing and releases it if it is in a closed memory loop.


Detailed Description

The ThingReferences namespace contains functions relating to the memory management system in Centum.

Function Documentation

CENTUMSHAREDCODE_API void ThingReferences::AddCThingReference CThing thing  ) 
 

Increases the reference count of a CThing object.

Each call to AddCThingReference must be matched to a single call to ReleaseCThing somewhere. AddCThinReference needs to acquire the mutex assocaited with the CThing object.

See also:
ReleaseCThing()
Parameters:
thing a valid CThing pointer, may be NULL

CENTUMSHAREDCODE_API void ThingReferences::AddCThingReferenceGC CThing thing,
CThing from
 

Increases the reference count of a CThing object and adds a backtrace pointer for garbage collection.

Each call to AddCThingReferenceGC must be matched to a single call to ReleaseCThingGC somewhere. AddCThinReferenceGC needs to acquire the mutex assocaited with the CThing object. This function adds the from pointer to the pointedto member of the thing parameter. The function itself calls AddCThingReference to increase the reference count.

See also:
ReleaseCThingGC()

AddCThingReference()

Parameters:
thing a valid CThing pointer, may be NULL
from a valid CThing pointer

CENTUMSHAREDCODE_API void ThingReferences::AddDefReference CDefinition def  ) 
 

Increases the reference count of a CDefinition object.

Each call to AddDefReference must be matched to a single call to ReleaseCDefinition somewhere. AddDefReference needs to acquire the mutex assocaited with the CDefinition object.

See also:
ReleaseCDefinition()
Parameters:
def a valid CDefinition pointer, may be NULL

CENTUMSHAREDCODE_API void ThingReferences::GarbageCollect CThing thing  ) 
 

Traces through the back-pointers stored in a thing and releases it if it is in a closed memory loop.

Calling Garbage collect on a CThing that has a reference count greater than its number of back-pointers is an error. This function operates by searching through each back pointer and then througn the back-pointers of all objects that can be found though back-pointers until either an object that has a reference count greater than its number of back pointers is found or all possible backpointers have been fully searched through. If the second is the case than the object is is a closed memory loop and this function releases it in the same manner that ReleaseCThing does, altough it does not call this function. Releasing this one CThing should release the entire memory loop.

See also:
AddCThingReferenceGC()

ReleaseCThingGC()

ReleaseCThing()

Parameters:
thing a valid CThing pointer, may NOT be NULL

CENTUMSHAREDCODE_API void ThingReferences::ReleaseCDefinition CDefinition def  ) 
 

Decrements the reference count of a CDefinition object and releases its memory if appropriate.

Calling ReleaseCDefinition more times than you have called AddDefReference is an error. This function needs to acquire the mutex associated with the definition. If you have aquired it you must release it before calling this function. ReleaseCThing is called on all static members.

See also:
AddDefReference()

ReleaseCThing()

Parameters:
def a valid CDefinition pointer, may be NULL

CENTUMSHAREDCODE_API void ThingReferences::ReleaseCThing CThing thing  ) 
 

Decrements the reference count of a CThing object and releases its memory if appropriate.

Calling ReleaseCThing more times than you have called AddCThingReference is an error. This function needs to acquire the mutex associated with the CThing. If you have aquired it you must release it before calling this function. If the reference count of the CThing is equal to the number of backpointers it has then GarbageCollect is called, which may or may not release it. Otherwise if its reference count is zero the objects locals and data are de-referenced, it is untied from other variables, and its memory is freed.

See also:
AddCThingReference()

GarbageCollect()

Parameters:
thing a valid CThing pointer, may be NULL

CENTUMSHAREDCODE_API void ThingReferences::ReleaseCThingGC CThing thing,
CThing from
 

Removes the appropriate back-pointer fromt the CThing parameter and decrements its reference count, releasing it if appropriate.

Calling ReleaseCThingGC more times than you have called AddCThingReferenceGC is an error. Likewise each call to AddCThingReferenceGC needs to be matched to a call to ReleaseCThingGC with the same from parameter. Internally the reference count it decremented through a call to ReleaseCThing.

See also:
ReleaseCThing()
Parameters:
thing a valid CThing pointer, may be NULL
from the CThing which previously was pointing to the thing parameter.


Generated on Sat Apr 16 16:31:09 2005 for Centum API by  doxygen 1.4.2