From cc0ea8a803d28e70c40669b37ece258331bba622 Mon Sep 17 00:00:00 2001 From: ZongyueQin Date: Mon, 17 Jul 2017 14:04:35 +0800 Subject: [PATCH] The files modified include Database.cpp ISTree.cpp ISStorage.cpp IVTree.cpp IVTree.h IVStorage.cpp KVstore.cppSITree.cpp SIStorage.cpp ClassForVlistCache.h Vlist.cpp --- Database/Database.cpp | 13 ++++++++++--- KVstore/ISTree/ISTree.cpp | 7 +++++++ KVstore/ISTree/storage/ISStorage.cpp | 1 + KVstore/IVTree/IVTree.cpp | 12 ++++++++++-- KVstore/IVTree/IVTree.h | 1 + KVstore/IVTree/storage/IVStorage.cpp | 1 + KVstore/KVstore.cpp | 10 +++++++++- KVstore/SITree/SITree.cpp | 5 +++++ KVstore/SITree/storage/SIStorage.cpp | 1 + Util/ClassForVlistCache.h | 6 +++++- Util/VList.cpp | 2 +- 11 files changed, 51 insertions(+), 8 deletions(-) diff --git a/Database/Database.cpp b/Database/Database.cpp index 0306107..f77aeea 100644 --- a/Database/Database.cpp +++ b/Database/Database.cpp @@ -1077,11 +1077,13 @@ Database::unload() { //TODO: do we need to update the pre2num if update queries exist?? //or we just neglect this, that is ok because pre2num is just used to count + cout << "delete pre2num" << endl; delete[] this->pre2num; this->pre2num = NULL; - + cout << "delete entity buffer" << endl; delete this->entity_buffer; this->entity_buffer = NULL; + cout << "delete literal buffer" << endl; delete this->literal_buffer; this->literal_buffer = NULL; @@ -1089,10 +1091,10 @@ Database::unload() //this->vstree->saveTree(); //delete this->vstree; //this->vstree = NULL; - + cout << "delete kvstore" << endl; delete this->kvstore; this->kvstore = NULL; - + cout << "delete stringindex" << endl; delete this->stringindex; this->stringindex = NULL; @@ -2300,6 +2302,7 @@ Database::sub2id_pre2id_obj2id_RDFintoSignature(const string _rdf_file) //cout<<"==> end while(true)"<stream; //maybe NULL + stream = NULL; + cout << "delete TSM" << endl; delete TSM; + TSM = NULL; #ifdef DEBUG_KVSTORE printf("already empty the buffer, now to delete all nodes in tree!\n"); #endif //recursively delete each Node + cout << "release" << endl; release(root); + cout << "~istree done" << endl; } void diff --git a/KVstore/ISTree/storage/ISStorage.cpp b/KVstore/ISTree/storage/ISStorage.cpp index bbfb4de..5c09384 100644 --- a/KVstore/ISTree/storage/ISStorage.cpp +++ b/KVstore/ISTree/storage/ISStorage.cpp @@ -664,6 +664,7 @@ ISStorage::~ISStorage() printf("already empty the freelist!\n"); #endif delete this->minheap; + minheap = NULL; #ifdef DEBUG_KVSTORE printf("already empty the buffer heap!\n"); #endif diff --git a/KVstore/IVTree/IVTree.cpp b/KVstore/IVTree/IVTree.cpp index 7a97a9f..57c0573 100644 --- a/KVstore/IVTree/IVTree.cpp +++ b/KVstore/IVTree/IVTree.cpp @@ -646,15 +646,23 @@ IVTree::AddIntoCache(TYPE_ENTITY_LITERAL_ID _id) IVTree::~IVTree() { + cout << "IVTree" << endl; + cout << "delete Vlist" << endl; delete this->value_list; - - delete this->stream; //maybe NULL + value_list = NULL; + cout << "delete stream" << endl; + delete this->stream;//maybe NULL + this->stream = NULL; + cout << "delete TSM" << endl; delete TSM; + TSM = NULL; #ifdef DEBUG_KVSTORE printf("already empty the buffer, now to delete all nodes in tree!\n"); #endif //recursively delete each Node + cout << "release" << endl; release(root); + cout << "~IVTree done" << endl; } void diff --git a/KVstore/IVTree/IVTree.h b/KVstore/IVTree/IVTree.h index 9f56391..19c5f1e 100644 --- a/KVstore/IVTree/IVTree.h +++ b/KVstore/IVTree/IVTree.h @@ -88,6 +88,7 @@ public: void resetStream(); bool range_query(unsigned _key1, unsigned _key2); bool save(); + void AddIntoCache(TYPE_PREDICATE_ID _id); void AddIntoCache(TYPE_ENTITY_LITERAL_ID _id); ~IVTree(); diff --git a/KVstore/IVTree/storage/IVStorage.cpp b/KVstore/IVTree/storage/IVStorage.cpp index deadf0a..d7ef614 100644 --- a/KVstore/IVTree/storage/IVStorage.cpp +++ b/KVstore/IVTree/storage/IVStorage.cpp @@ -714,6 +714,7 @@ IVStorage::~IVStorage() printf("already empty the freelist!\n"); #endif delete this->minheap; + this->minheap = NULL; #ifdef DEBUG_KVSTORE printf("already empty the buffer heap!\n"); #endif diff --git a/KVstore/KVstore.cpp b/KVstore/KVstore.cpp index acc449a..cecd46f 100644 --- a/KVstore/KVstore.cpp +++ b/KVstore/KVstore.cpp @@ -59,25 +59,33 @@ KVstore::flush() void KVstore::release() { + cout << "delete entity2id" << endl; delete this->entity2id; this->entity2id = NULL; + cout << "delete id2eneity" << endl; delete this->id2entity; this->id2entity = NULL; - + cout << "delete literal2id" << endl; delete this->literal2id; this->literal2id = NULL; + cout << "delete id2leteral" << endl; delete this->id2literal; this->id2literal = NULL; + cout << "delete p2id" << endl; delete this->predicate2id; this->predicate2id = NULL; + cout << "delte id2p" << endl; delete this->id2predicate; this->id2predicate = NULL; + cout << "delete s2v" << endl; delete this->subID2values; this->subID2values = NULL; + cout << "delete p2v" << endl; delete this->preID2values; this->preID2values = NULL; + cout << "delete o2v" << endl; delete this->objID2values; this->objID2values = NULL; } diff --git a/KVstore/SITree/SITree.cpp b/KVstore/SITree/SITree.cpp index 4eaf8f3..10a1443 100644 --- a/KVstore/SITree/SITree.cpp +++ b/KVstore/SITree/SITree.cpp @@ -454,12 +454,17 @@ SITree::release(SINode* _np) const SITree::~SITree() { + cout << "SITree" << endl; + cout << "delete TSM" << endl; delete TSM; + TSM = NULL; #ifdef DEBUG_KVSTORE printf("already empty the buffer, now to delete all nodes in tree!\n"); #endif + cout << "release" << endl; //recursively delete each SINode release(root); + cout << "~SITree done" << endl; } void diff --git a/KVstore/SITree/storage/SIStorage.cpp b/KVstore/SITree/storage/SIStorage.cpp index 442791d..b86b0d4 100644 --- a/KVstore/SITree/storage/SIStorage.cpp +++ b/KVstore/SITree/storage/SIStorage.cpp @@ -649,6 +649,7 @@ SIStorage::~SIStorage() printf("already empty the freelist!\n"); #endif delete this->minheap; + minheap = NULL; #ifdef DEBUG_KVSTORE printf("already empty the buffer heap!\n"); #endif diff --git a/Util/ClassForVlistCache.h b/Util/ClassForVlistCache.h index ff743f6..2e8a5bb 100644 --- a/Util/ClassForVlistCache.h +++ b/Util/ClassForVlistCache.h @@ -28,6 +28,10 @@ public: } ~Longlist_inMem() { - if(_str != NULL) delete []_str; + if(_str != NULL) + { + delete [] _str; + _str = NULL; + } } }; diff --git a/Util/VList.cpp b/Util/VList.cpp index 1c34e8c..77c2ca6 100644 --- a/Util/VList.cpp +++ b/Util/VList.cpp @@ -150,7 +150,7 @@ VList::AllocBlock() unsigned t = p->num; this->freelist->next = p->next; delete p; - + p = NULL; return t; }