library/src/garbage_collection/BP_MemoryGarbageCollector.cc
// destroys all unfreed chunks used by the garbage collector
destroys all unfreed chunks used by the garbage collector
destroys all unfreed chunks used by the garbage collector
size_t BP_GarbageCollectorFreeAllChunks(P_BP_GARBAGE_COLLECTOR_DATA gc)
{
	if(!gc)
		return ERR_FAILURE;
	if(!gc->chunks)
		return ERR_FAILURE;
	P_BP_GARBAGE_COLLECTOR_ALLOC_CHUNK chunks = gc->chunks->first;
	if(chunks)
	for(; chunks; chunks = gc->chunks->first)
	{
		if(!chunks)
			break;
		if(BP_free(gc, NULL, chunks->chunk_ptr) == ERR_FAILURE)
			break;
		if(!gc->chunks)
		{
			break;
		}
	}
	gc->chunks = NULL;
	return ERR_SUCCESS;
}
size_t BP_GarbageCollectorFreeAllChunks ( P_BP_GARBAGE_COLLECTOR_DATA gc ) { if ( ! gc ) return ERR_FAILURE ; if ( ! gc -> chunks ) return ERR_FAILURE ; P_BP_GARBAGE_COLLECTOR_ALLOC_CHUNK chunks = gc -> chunks -> first ; if ( chunks ) for ( ; chunks ; chunks = gc -> chunks -> first ) { if ( ! chunks ) break ; if ( BP_free ( gc , NULL , chunks -> chunk_ptr ) == ERR_FAILURE ) break ; if ( ! gc -> chunks ) { break ; } } gc -> chunks = NULL ; return ERR_SUCCESS ; }
destroys all unfreed chunks used by the garbage collector
destroys all unfreed chunks used by the garbage collector
// ensure we have a valid incomming value // printf("\n Freeing remainder of the chunks here."); // check for chunks pointer // printf("\n --Function entry gc->chunks->first()---"); // BP_GargbageCollectorPrintChunk(gc->chunks->first); // if we have a chunks pointer // check to see that we have a chunks pointer // bpfree the chunk pointer // reset chunks pointer // forcibly set chunk value // printf("\n Exiting chunk destroyer loop"); // return