void MemoryManager::showAllocatedMemory() { unsigned int beginAllocatedAddress, endAllocatedAddress, totalAllocated, processId, internalFragmentation, externalFragmentation; // INSERT YOUR CODE TO SHOW EACH ONE OF THE ALLOCATED MEMORY PARTITIONS, INCLUDING INTERNAL AND EXTERNAL (THE FOLLOWING) FRAGMENTATION for (int index = 0; index < NUMBER_PARTITIONS; index++) { // for each partition... Partition* partition = getPartition(index); beginAllocatedAddress = partition->getBeginAddress(); endAllocatedAddress = partition->getEndAddress(); totalAllocated = partition->getLength(); externalFragmentation = 0; if (partition->hasProcess()) { Process *process = partition->getProcess(); processId = process->getId(); internalFragmentation = totalAllocated - functions::getProcessSize(process); } else { internalFragmentation = totalAllocated; processId = 0; } // no not change the next line (the way information are shown) std::cout << "\tAllocd: " << "B=" << (beginAllocatedAddress) << ", \tE=" << (endAllocatedAddress) << ", \tT=" << (totalAllocated) << ", \tPID=" << (processId) << ", \tIF=" << (internalFragmentation) << ", \tEF=" << (externalFragmentation) << "\n"; } beginAllocatedAddress = 0; endAllocatedAddress = 0; totalAllocated = 0; processId = 0; internalFragmentation = 0; externalFragmentation = 0; }
/// warn if readahead > 256KB (gridfs chunk size) static void checkReadAhead(const string& dir) { #ifdef __linux__ const dev_t dev = getPartition(dir); // This path handles the case where the filesystem uses the whole device (including LVM) string path = str::stream() << "/sys/dev/block/" << major(dev) << ':' << minor(dev) << "/queue/read_ahead_kb"; if (!boost::filesystem::exists(path)){ // This path handles the case where the filesystem is on a partition. path = str::stream() << "/sys/dev/block/" << major(dev) << ':' << minor(dev) // this is a symlink << "/.." // parent directory of a partition is for the whole device << "/queue/read_ahead_kb"; } if (boost::filesystem::exists(path)) { ifstream file (path.c_str()); if (file.is_open()) { int kb; file >> kb; if (kb > 256) { log() << startupWarningsLog; log() << "** WARNING: Readahead for " << dir << " is set to " << kb << "KB" << startupWarningsLog; log() << "** We suggest setting it to 256KB (512 sectors) or less" << startupWarningsLog; log() << "** http://dochub.mongodb.org/core/readahead" << startupWarningsLog; } } }
vector<vector<string>> partition(string s) { vector<vector<string>> result; if (s.empty()) return result; vector<string> solution; getPartition(result, s, 0, solution); return result; }
/** * @brief 快速排序算法 * @param arr * @param i * @param j */ void QuickSort(int* arr, int i, int j) { if(i < j) { int pivot = getPartition(arr, i, j); QuickSort(arr, i, pivot - 1); QuickSort(arr, pivot + 1, j); } }
void MemoryManager::allocateMemoryForProcess(Process* process) { // INSERT YOUR CODE TO ALLOCATE MEMOTY FOR THE PROCESS for (unsigned int index = 0; index < NUMBER_PARTITIONS; index++) { Partition *partition = getPartition(index); if (functions::fits(process, partition)) { partition->allocateProcess(process); return; } } std::cout << "\nPROCESS DOESN'T FIT IN ANY PARTITION\n"; //throw 0; }
void MemoryManager::deallocateMemoryOfProcess(Process* process) { // INSERT YOUR CODE TO DEALLOCATE MEMORY OF THE PROCESS for (unsigned int index = 0; index < NUMBER_PARTITIONS; index++) { Partition *partition = getPartition(index); if (partition->hasProcess()) { if (partition->getProcess()->getId() == process->getId()) { partition->deallocateProcess(); return; } } } }
void getPartition(vector<vector<string>>& result, string s, int index, vector<string>& solution) { if (index == s.size()) { result.emplace_back(solution); return; } for (int i = index; i < s.size(); ++i) { if (isPalindrome(s, index, i)) { solution.emplace_back(s.substr(index, i+1 - index)); getPartition(result, s, i+1, solution); solution.pop_back(); } } }
size_t Map::removeAllMatches(const Slice& key, Predicate predicate) { return getPartition(key)->removeAllMatches(key, predicate); }
bool Map::removeFirstMatch(const Slice& key, Predicate predicate) { return getPartition(key)->removeFirstMatch(key, predicate); }
size_t Map::removeAllEqual(const Slice& key, const Slice& value) { return getPartition(key)->removeAllEqual(key, value); }
bool Map::removeFirstEqual(const Slice& key, const Slice& value) { return getPartition(key)->removeFirstEqual(key, value); }
size_t Map::remove(const Slice& key) { return getPartition(key)->remove(key); }
int main(int argc, char **argv) { char **inputNameTable, **name, inputFileName[STRING_SIZE], outputFileName[STRING_SIZE], effectifFileName[STRING_SIZE], outputPrefix[STRING_SIZE], outputFileNameRand[STRING_SIZE], buffer[STRING_SIZE], inputFileNameModel[STRING_SIZE], *tmp, option[256]; FILE *fi, *fo, *fs; int i, j, t, sizeTable, singleF = 0; TypeMultiGraph *graph, *gtmp; TypeGraph **tableGraph, *g; TypePartition part, *tablePart; double alpha = 1.; for(i=0; i<256; i++) option[i] = 0; sprintf(outputFileName, "%s.%s", NAME_OUTPUT, EXT_OUTPUT); tableGraph = (TypeGraph**) malloc((argc+3)*sizeof(TypeGraph*)); inputNameTable = (char**) malloc((argc+3)*sizeof(char*)); sizeTable = 0; for(i=1; i<argc && *(argv[i]) == '-'; i++) { for(j=1; argv[i][j] != '\0'; j++) option[argv[i][j]] = 1; if(option['o']) { option['o'] = 0; if((i+1)<argc && sscanf(argv[i+1], "%s", outputFileName) == 1) i++; else exitProg(ErrorArgument, "a file name is required after option -f"); } if(option['s']) { option['s'] = 0; singleF = 1; } if(option['p']) { option['p'] = 0; if((i+1)<argc && sscanf(argv[i+1], "%lf", &alpha) == 1) i++; else exitProg(ErrorArgument, "a real number is required after option -p"); } if(option['m']) { option['m'] = 0; if(!(sscanf(argv[i+1], "%s", inputFileName) == 1)) exitProg(ErrorArgument, "wrong file name"); i++; inputNameTable[sizeTable] = (char*) malloc((strlen(inputFileName)+1)*sizeof(char)); strcpy(inputNameTable[sizeTable], inputFileName); printf("Reading file %s\n", inputNameTable[sizeTable]); if(fi = fopen(inputNameTable[sizeTable], "r")) { tableGraph[sizeTable++] = readMatrixGraph(fi); fclose(fi); } else exitProg(ErrorReading, inputNameTable[sizeTable]); } if(option['h']) { option['h'] = 0; printf("%s\n", HELPMESSAGE); exit(0); } } for(j=i; j<argc; j++) { if(!(sscanf(argv[j], "%s", inputFileName) == 1)) exitProg(ErrorArgument, "wrong file name"); inputNameTable[sizeTable] = (char*) malloc((strlen(inputFileName)+1)*sizeof(char)); strcpy(inputNameTable[sizeTable], inputFileName); printf("Reading file %s\n", inputNameTable[sizeTable]); if(fi = fopen(inputNameTable[sizeTable], "r")) { tableGraph[sizeTable] = readGraph(fi); fclose(fi); } else exitProg(ErrorReading, inputNameTable[sizeTable]); fixEdgeGraph(tableGraph[sizeTable]); printf("%d nodes\n", tableGraph[sizeTable]->sizeGraph); sizeTable++; } if(sizeTable <= 0) exitProg(ErrorArgument, "at least one graph is required."); strcpy(outputPrefix, outputFileName); if((tmp = strrchr(outputPrefix, '.')) != NULL) tmp[0] = '\0'; graph = toMultiGraph(tableGraph, sizeTable); part = getPartition(graph, LouvainType, &alpha); tableGraph[sizeTable] = sumMultiGraph(graph); inputNameTable[sizeTable] = (char*) malloc((strlen("Sum")+1)*sizeof(char)); strcpy(inputNameTable[sizeTable], "Sum"); sizeTable++; tableGraph[sizeTable] = unionMultiGraph(graph); inputNameTable[sizeTable] = (char*) malloc((strlen("Union")+1)*sizeof(char)); strcpy(inputNameTable[sizeTable], "Union"); sizeTable++; tableGraph[sizeTable] = interMultiGraph(graph); inputNameTable[sizeTable] = (char*) malloc((strlen("Intersection")+1)*sizeof(char)); strcpy(inputNameTable[sizeTable], "Intersection"); sizeTable++; name = (char**) malloc(sizeTable*sizeof(char*)); for(t=0; t<sizeTable; t++) { char *tmp; if((tmp = strrchr(inputNameTable[t], '.')) != NULL) tmp[0] = '\0'; if((tmp=strrchr(inputNameTable[t], '/')) == NULL) tmp = inputNameTable[t]; else tmp++; name[t] = (char*) malloc((strlen(tmp)+1)*sizeof(char)); strcpy(name[t], tmp); // printf("name[%d]\t%s\n", t, name[t]); } tablePart = (TypePartition*) malloc(sizeTable*sizeof(TypePartition)); if(singleF) { TypeMultiGraph *gtmp; gtmp = (TypeMultiGraph*) malloc(sizeof(TypeMultiGraph)); gtmp->sizeTable = 1; gtmp->edge = (TypeEdgeG***) malloc(sizeof(TypeEdgeG**)); gtmp->present = (int**) malloc(sizeof(int*)); gtmp->present[0] = (int*) malloc(graph->sizeGraph*sizeof(int)); for(i=0; i<graph->sizeGraph; i++) gtmp->present[0][i] = 1; for(t=0; t<sizeTable; t++) { char output[STRING_SIZE], *tmp; fillMultiOne(tableGraph[t], gtmp); sprintf(output, "%s_%s.%s", outputPrefix, name[t], EXT_OUTPUT); printf("Computing %s\n", output); tablePart[t] = getPartition(gtmp, LouvainType, &alpha); if(fo = fopen(output, "w")) { fprintPartitionClustNSee(fo, &(tablePart[t]), gtmp->name); fclose(fo); } else exitProg(ErrorWriting, output); } free((void*)gtmp->present[0]); free((void*)gtmp->present); free((void*)gtmp->edge); free((void*)gtmp); } if(fo = fopen(outputFileName, "w")) { fprintPartitionClustNSee(fo, &part, graph->name); fclose(fo); } else exitProg(ErrorWriting, outputFileName); sprintf(effectifFileName, "%s_effectif.csv", outputPrefix); if(fo = fopen(effectifFileName, "w")) { int **eff, c, t, *cs; eff = getEdgesNumbers(&part, graph); cs = getClassSize(&part); fprintf(fo, "\tSize"); for(t=0; t<graph->sizeTable; t++) fprintf(fo, "\t%s", name[t]); fprintf(fo, "\n"); for(c=0; c<part.sizeAtom; c++) { fprintf(fo, "ClusterID:%d", c+1); fprintf(fo, "\t%d", cs[c]); for(t=0; t<graph->sizeTable; t++) { fprintf(fo, "\t%d", eff[c][t]); } fprintf(fo, "\n"); } fclose(fo); for(c=0; c<part.sizeAtom; c++) free((void*)eff[c]); free((void*)eff); free((void*)cs); } else exitProg(ErrorWriting, effectifFileName); if(singleF) { for(t=sizeTable-3; t<sizeTable; t++) { sprintf(effectifFileName, "%s_%s_effectif.csv", outputPrefix, name[t]); if((fo = fopen(effectifFileName, "w"))) { int **eff, c, t, *cs; eff = getEdgesNumbers(&(tablePart[sizeTable-1]), graph); cs = getClassSize(&(tablePart[sizeTable-1])); fprintf(fo, "\tSize"); for(t=0; t<graph->sizeTable; t++) fprintf(fo, "\t%s", name[t]); fprintf(fo, "\n"); for(c=0; c<tablePart[sizeTable-1].sizeAtom; c++) { fprintf(fo, "ClusterID:%d", c+1); fprintf(fo, "\t%d", cs[c]); for(t=0; t<graph->sizeTable; t++) { fprintf(fo, "\t%d", eff[c][t]); } fprintf(fo, "\n"); } fclose(fo); for(c=0; c<tablePart[sizeTable-1].sizeAtom; c++) free((void*)eff[c]); free((void*)eff); free((void*)cs); } else exitProg(ErrorWriting, effectifFileName); sprintf(effectifFileName, "%s_%s_graph.csv", outputPrefix, name[t]); if((fo = fopen(effectifFileName, "w"))) { fprintGraph(fo, tableGraph[t]); } else exitProg(ErrorWriting, effectifFileName); } } if(singleF) { int tl, tc; char *tmp; sprintf(outputFileNameRand, "%s_Rand.csv", outputPrefix); if(fo = fopen(outputFileNameRand, "w")) { char *tmp; fprintf(fo,"All\t%lf\n", comparePartDiff(correctedRandIndex, &(part), graph->name, &(part), graph->name)); for(tl=0; tl<sizeTable; tl++) { fprintf(fo, "%s\t%lf", name[tl], comparePartDiff(correctedRandIndex, &(part), graph->name, &(tablePart[tl]), tableGraph[tl]->name)); for(tc=0; tc<=tl; tc++) fprintf(fo, "\t%lf", comparePartDiff(correctedRandIndex, &(tablePart[tc]), tableGraph[tc]->name, &(tablePart[tl]), tableGraph[tl]->name)); fprintf(fo, "\n"); } fprintf(fo, "\tAll"); for(tl=0; tl<sizeTable; tl++) { fprintf(fo, "\t%s", name[tl]); } fprintf(fo, "\n"); fclose(fo); } else exitProg(ErrorWriting, outputFileNameRand); } for(t=0; t<sizeTable; t++) { freeGraph(tableGraph[t]); free((void*) name[t]); free((void*) inputNameTable[t]); } free((void*) tableGraph); free((void*) name); free((void*) inputNameTable); exit(0); return 0; }
void Map::forEachValue(const Slice& key, Procedure process) const { getPartition(key)->forEachValue(key, process); }
bool Map::replaceFirstMatch(const Slice& key, Function map) { return getPartition(key)->replaceFirstMatch(key, map); }
bool Map::replaceFirstEqual(const Slice& key, const Slice& old_value, const Slice& new_value) { return getPartition(key)->replaceFirstEqual(key, old_value, new_value); }
int main(int argc, char *argv[]) { FILE * file; int i, indirectCount, indirectNode; int zoneCount = 0; int partitionOffset = 0; SUPERBLOCK *diskinfo; INODE *node, *tempNode; DIRECT *direct; ARGSP *argsp; diskinfo = malloc(sizeof(SUPERBLOCK)); node = malloc(sizeof(INODE)); tempNode = malloc(sizeof(INODE)); direct = malloc(sizeof(DIRECT)); argsp = malloc(sizeof(ARGSP)); /* Grab Args */ getArgs(argsp, argc, argv); if(argsp->hflag) { printUsage(); exit(1); } /* Open File */ file = fopen(argsp->image, "r"); if (file == NULL) { perror("Some Error:"); exit (1); } /* Grab Partition offset */ if((partitionOffset = getPartition(file, argsp)) < 0) { fputs("Bad partition\n",stderr); exit(1); } /* Grab node for file */ if(!(node = minInitialize(file, diskinfo, argsp, partitionOffset))) { fputs("File not found\n",stderr); exit(1); } /* current node should be the matching diretory or file */ if((node->mode & FILEMASK & DIRECTORYMASK)) { zoneCount = 0; indirectCount = 0; printf("%s:\n", argsp->path); fseek(file, partitionOffset + diskinfo->zonesize * node->zone[zoneCount], SEEK_SET); for(i = 0; i < node->size / sizeof(DIRECT); i++) { fread(direct, sizeof(DIRECT), 1, file); if(direct->inode) { getNode(tempNode, file, diskinfo, direct->inode, partitionOffset); printItem(tempNode, direct->name); } /* check to see if we are at the end of a zone and need to move to next zone*/ if(((i+1) * sizeof(DIRECT) % diskinfo->zonesize) == 0) { if (zoneCount < REGULAR_ZONES-1) { zoneCount++; fseek(file, partitionOffset + diskinfo->zonesize * node->zone[zoneCount], SEEK_SET); } else { /* jump to indirect block plus offset */ fseek(file, partitionOffset + diskinfo->zonesize * node->zoneindirect + (sizeof(uint32_t) * indirectCount), SEEK_SET); indirectCount++; /* grab new zone value */ fread(&indirectNode, sizeof(uint32_t), 1, file); /* set filepointer to new indirect zone */ fseek(file, partitionOffset + diskinfo->zonesize * indirectNode, SEEK_SET); } } } } else { printItem(node, argsp->path); } freeArgs(argsp); free(argsp); free(direct); free(tempNode); free(node); free(diskinfo); fclose(file); exit(0); }
size_t Map::replaceAllEqual(const Slice& key, const Slice& old_value, const Slice& new_value) { return getPartition(key)->replaceAllEqual(key, old_value, new_value); }
void MigrationVerifyActor::handleLocalVerifyRequest(const idgs::actor::ActorMessagePtr& msg) { pb::MigrationVerifyRequest* request = NULL; if (msg->getPayload()) { request = dynamic_cast<pb::MigrationVerifyRequest*>(msg->getPayload().get()); } auto datastore = idgs::store::idgs_store_module()->getDataStore(); std::vector<idgs::store::StorePtr> stores; if (request && request->has_schema_name() && request->has_store_name()) { auto store = datastore->getStore(request->schema_name(), request->store_name()); stores.push_back(store); } else { datastore->getStores(stores); } auto app = idgs_application(); auto cluster = app->getClusterFramework(); auto pcnt = cluster->getPartitionCount(); auto bkcnt = cluster->getClusterConfig()->max_replica_count() - 1; auto local = cluster->getLocalMember()->getId(); auto partitionMgr = app->getPartitionManager(); auto payload = std::make_shared<pb::MigrationVerifyResponse>(); payload->set_result_code(static_cast<int32_t>(RC_SUCCESS)); auto memberData = payload->add_member_data(); memberData->set_member_id(local); for (int32_t i = 0; i < stores.size(); ++ i) { auto& store = stores.at(i); auto& storeConfigWrapper = store->getStoreConfig(); if (storeConfigWrapper->getStoreConfig().partition_type() == idgs::store::pb::PARTITION_TABLE) { auto pstore = dynamic_cast<idgs::store::PartitionedStore*>(store.get()); auto& schemaName = store->getStoreConfig()->getSchema(); auto& storeName = store->getStoreConfig()->getStoreConfig().name(); auto storeData = memberData->add_store_data(); storeData->set_schema_name(schemaName); storeData->set_store_name(storeName); for (int32_t p = 0; p < pcnt; ++ p) { auto partition = partitionMgr->getPartition(p); for (int32_t pos = 0; pos < bkcnt + 1; ++ pos) { if (partition->getMemberId(pos) == local) { auto partitionData = storeData->add_partition_data(); partitionData->set_partition_id(p); partitionData->set_position(pos); partitionData->set_member_id(local); partitionData->set_size(pstore->dataSize(p)); VLOG(0) << schemaName << "." << storeName << " partition " << p << "(" << pos << ") data size " << partitionData->size() << " on member " << local; std::shared_ptr<idgs::store::StoreMap> map; pstore->snapshotStore(p, map); auto it = map->iterator(); while (it->hasNext()) { idgs::store::StoreOption ps; storeConfigWrapper->calculatePartitionInfo(it->key(), &ps); ps.memberId = partitionMgr->getPartition(ps.partitionId)->getMemberId(pos); auto keyPartition = partitionData->add_key_partition(); keyPartition->set_key_partition_id(ps.partitionId); keyPartition->set_key_member_id(ps.memberId); it->next(); } } } } } } auto respMsg = msg->createResponse(); respMsg->setOperationName("VERIFY_RESPONSE"); respMsg->setPayload(payload); idgs::actor::sendMessage(respMsg); }
size_t Map::replaceAllMatches(const Slice& key, Function map) { return getPartition(key)->replaceAllMatches(key, map); }
std::unique_ptr<Iterator> Map::get(const Slice& key) const { return getPartition(key)->get(key); }
void Map::put(const Slice& key, const Slice& value) { getPartition(key)->put(key, value); }
/******************************************************************* Function: ScoreCompThread Score Computation Input/Output: m: Process Data Structure *******************************************************************/ void * ScoreCompThread (ProcessData * pData, ScoringData * sData, WavesData * wData) { MOATypeDimn k, j; long ocWave; #ifndef NDEBUG int dbglevel = 1; char msg[MID_MESSAGE_SIZE]; #endif #ifndef NDEBUG sprintf (msg, "[%d]>ScoreCompThread: Loop To Compute Scores for total [%ld] Partitions in this process\nEnter loop ******************************************\n", myProcid, pData->partitionsCount); mprintf (dbglevel, msg, 1); #endif //while ((pData->waveNo < wData->wavesTotal) && (pData->partitionsCount > 0)) { sData->waveNo = pData->waveNo; pData->mpi_requests = NULL; pData->sendRequests = 0; while (pData->globalWaveNo < wData->wavesTotal) { while (pData->waveNo == pData->globalWaveNo) { getPartition (wData->partsInWaveIndices[pData->waveNo][pData->partNo], pData->seqNum, pData->seqLen, &pData->msaAlgn, wData->partitionSize); /* Compute Scored for Current Partition*/ #ifndef NDEBUG sprintf (msg, "[%d]>ScoreCompThread[%ld]: Will call ComputePartitionScores\n", myProcid, pData->computedPartitions); mprintf (dbglevel, msg, 1); #endif if (Algorithm == DP) DPComputeScores (pData, sData, wData); else if (Algorithm == SP) SPComputeScores (pData, sData, wData); //printMOA_scr(pData->msaAlgn, 0); #ifndef NDEBUG sprintf (msg, "[%d]>ScoreCompThread[%ld]: Will call printMOA\n", myProcid, pData->computedPartitions); mprintf (dbglevel, msg, 1); /* Print elements ======================================================= */ printMOA(2, pData->msaAlgn, pData->sequences, 0); /* Print Indexes ========================================================*/ printMOA(2, pData->msaAlgn, pData->sequences, 1); sprintf (msg, "[%d]>ScoreCompThread[%ld]: - wave: %ld order: %ld has %lld elm\n", myProcid, pData->computedPartitions-1, pData->waveNo, pData->partNo, pData->msaAlgn->elements_ub); mprintf (dbglevel, msg, 1); sprintf (msg, "[%d]>ScoreCompThread[%ld]: Will call getNextPartition\n", myProcid, pData->computedPartitions-1); mprintf (dbglevel, msg, 1); #endif /****** For testing checkpoint resume **************************** if (!RestoreFlag && pData->computedPartitions == force_exit) { sprintf (msg, "[%d]>ScoreCompThread[%ld]: Forced to exit\n", myProcid, pData->computedPartitions); mprintf (dbglevel, msg, 1); break; } *****************************************************************/ printf ("[%d]W %ld/%ld PO %ld/%ld Part %ld/%ld(T:%ld) PI {%lld ", myProcid, pData->waveNo, wData->wavesTotal, pData->partNo, wData->partsInWave[pData->waveNo], pData->computedPartitions+1, pData->partitionsCount, wData->partsTotal, pData->msaAlgn->indexes[0][0]); for (k=1;k<pData->seqNum;k++) printf (", %lld", pData->msaAlgn->indexes[0][k]); printf ("}\n"); fflush(stdout); getNextPartition (wData, &pData->waveNo, &pData->partNo); checkPoint (pData, sData); pData->computedPartitions ++; } if ((pData->waveNo > sData->waveNo) || (pData->waveNo != pData->globalWaveNo)) { #ifndef NDEBUG sprintf (msg, "[%d]>ScoreCompThread[%ld] w%ld: Will communicate\n", myProcid, pData->computedPartitions, pData->waveNo); mprintf (dbglevel, msg, 1); #endif if (pData->waveNo > sData->waveNo) { prepareWaveOC (sData->waveNo, pData); sendOCtoHigherProcessors(pData); } MPI_Barrier(MOAMSA_COMM_WORLD); receiveOC(pData, sData); if (pData->waveNo > sData->waveNo) sendOCtoLowerProcessors(pData); MPI_Barrier(MOAMSA_COMM_WORLD); receiveOC(pData, sData); pData->globalWaveNo ++; /*Delete OC in waves before k (dimn or seqNum) waves from the current wave.*/ if (pData->waveNo > pData->seqNum + 1) { ocWave = pData->waveNo - pData->seqNum - 1; if (pData->OCin != NULL) { if ((pData->OCin[ocWave].WOCI != NULL) && (pData->OCin[ocWave].wavesOC > 0)) { for (j=0;j<pData->OCin[ocWave].wavesOC;j++) { if (pData->OCin[ocWave].WOCI[j].cellIndex != NULL) { free (pData->OCin[ocWave].WOCI[j].cellIndex); pData->OCin[ocWave].WOCI[j].cellIndex = NULL; } } free (pData->OCin[ocWave].WOCI); pData->OCin[ocWave].WOCI = NULL; } pData->OCin[ocWave].wavesOC = 0; } if (pData->OCout != NULL) { if ((pData->OCout[ocWave].WOCO != NULL) && (pData->OCout[ocWave].wavesOC > 0)) { for (j=0;j<pData->OCout[ocWave].wavesOC;j++) { if (pData->OCout[ocWave].WOCO[j].cellIndex != NULL) { free (pData->OCout[ocWave].WOCO[j].cellIndex); pData->OCout[ocWave].WOCO[j].cellIndex = NULL; } if ((pData->OCout[ocWave].WOCO[j].depProc_ub > 0) && (pData->OCout[ocWave].WOCO[j].depProc != NULL)) { free(pData->OCout[ocWave].WOCO[j].depProc); pData->OCout[ocWave].WOCO[j].depProc = NULL; } } free (pData->OCout[ocWave].WOCO); pData->OCout[ocWave].WOCO = NULL; } pData->OCout[ocWave].wavesOC = 0; } } } //if ((pData->computedPartitions >= pData->partitionsCount) || (pData->partNo < 0)){ if (pData->partNo < 0) { pData->waveNo = wData->wavesTotal; /*to get out of the main loop*/ } } //PrintPrevChains (pData->msaAlgn); pData->compFinished = 1; return NULL; }