VOID DestroyCachePool(PCACHE_POOL CachePool) { DestroyList(&CachePool->HotList); DestroyList(&CachePool->ColdList); // B+ Tree Destroy Destroy_Tree(CachePool->hot_bpt_root); Destroy_Tree(CachePool->cold_bpt_root); CachePool->hot_bpt_root = NULL; CachePool->cold_bpt_root = NULL; DestroyStoragePool(&CachePool->Storage); }
VOID DestroyCachePool(PCACHE_POOL CachePool) { // B+ Tree Destroy DestroyList(&CachePool->ProtectedList); DestroyList(&CachePool->ProbationaryList); Destroy_Tree(CachePool->Protected_bpt_root); Destroy_Tree(CachePool->Probationary_bpt_root); CachePool->Protected_bpt_root = NULL; CachePool->Probationary_bpt_root = NULL; DestroyStoragePool(&CachePool->Storage); }
//ELIMINO ALBERO RICORSIVAMENTE void Destroy_Tree(struct node *nodep){ if(nodep!=NULL){ if(nodep->NO != NULL) Destroy_Tree(nodep->NO); if(nodep->NW != NULL) Destroy_Tree(nodep->NW); if(nodep->SW != NULL) Destroy_Tree(nodep->SW); if(nodep->SO != NULL) Destroy_Tree(nodep->SO); free(nodep); } }