library/src/garbage_collection/BP_MemoryGarbageCollector.cc
// Destroys a garbage collector structure (does not bpfree individual chunk pointers but
// does destroy chunk structures.  Make sure chunks are bpfreed before this is call or they
// could go floating.
Destroys a garbage collector structure (does not bpfree individual chunk pointers but
does destroy chunk structures.  Make sure chunks are bpfreed before this is call or they
could go floating.
Destroys a garbage collector structure ( does not bpfree individual chunk pointers but does destroy chunk structures . Make sure chunks are bpfreed before this is call or they could go floating .
size_t BP_DestroyGarbageCollector(P_BP_GARBAGE_COLLECTOR_DATA gc)
{
	if(!gc)
	{
		return ERR_FAILURE;
	}
	size_t i = 0;
	if(gc->chunks)
	for
	(
			gc->chunks = gc->chunks->first;
			gc->chunks;
	)
	{
		if(gc->chunks->next)
		{
			gc->chunks = gc->chunks->next;
			bpfree(gc->chunks->prev);
			gc->chunks->prev = NULL;
		}
		else
		{
			bpfree(gc->chunks);
			gc->chunks = NULL;
			break;
		}
	}
	bpfree(gc);
	return ERR_SUCCESS;
}
size_t BP_DestroyGarbageCollector ( P_BP_GARBAGE_COLLECTOR_DATA gc ) { if ( ! gc ) { return ERR_FAILURE ; } size_t i = 0 ; if ( gc -> chunks ) for ( gc -> chunks = gc -> chunks -> first ; gc -> chunks ; ) { if ( gc -> chunks -> next ) { gc -> chunks = gc -> chunks -> next ; bpfree ( gc -> chunks -> prev ) ; gc -> chunks -> prev = NULL ; } else { bpfree ( gc -> chunks ) ; gc -> chunks = NULL ; break ; } } bpfree ( gc ) ; return ERR_SUCCESS ; }
Destroys a garbage collector structure (does not bpfree individual chunk pointers but
does destroy chunk structures.
Destroys a garbage collector structure ( does not bpfree individual chunk pointers but does destroy chunk structures .
// check for garbage collector // destroy bpreallocated chunks list // now destroy the full structure // return indicating success