- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在 gdb 下运行一个 C++ 程序到 Debian 7 64 位机器 4gb RAM 中,我遇到了 Bad_alloc 问题。尝试在 gdb 下运行它这是回溯
Program received signal SIGABRT, Aborted.
0x00007ffff72e5475 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff72e5475 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff72e86f0 in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff7b3b89d in __gnu_cxx::__verbose_terminate_handler() ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff7b39996 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff7b399c3 in std::terminate() ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff7b39bee in __cxa_throw ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007ffff7b3a0dd in operator new(unsigned long) ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7 0x000000000040bfdb in allocate (__n=67108864, this=)
at /usr/include/c++/4.7/ext/new_allocator.h:94
#8 _M_allocate (__n=, this=)
at /usr/include/c++/4.7/bits/stl_vector.h:169
#9 std::vector >::_M_insert_aux (
this=this@entry=0x1f50c68, __position=..., __position@entry=..., __x=...)
at /usr/include/c++/4.7/bits/vector.tcc:343
#10 0x00000000004201eb in push_back (__x=..., this=0x1f50c68)
at /usr/include/c++/4.7/bits/stl_vector.h:893
#11 RDFCFTree::closedExtensionExplore (this=this@entry=0x21349950,
frequency=..., outFile=..., database=..., occList=..., frequent2Tree=...,
headIndex=..., threshold=@0x7fffffffd818: 6, checked=..., closed=...,
maximal=...) at RDFCFTree.cpp:1280
#12 0x000000000041ffd0 in RDFCFTree::closedExtensionExplore (
this=this@entry=0x1284a10, frequency=..., outFile=..., database=...,
occList=..., frequent2Tree=..., headIndex=...,
threshold=@0x7fffffffd818: 6, checked=..., closed=..., maximal=...)
at RDFCFTree.cpp:1302
#13 0x000000000041ffd0 in RDFCFTree::closedExtensionExplore (
this=this@entry=0x737a20, frequency=..., outFile=..., database=...,
occList=..., frequent2Tree=..., headIndex=...,
threshold=@0x7fffffffd818: 6, checked=..., closed=..., maximal=...)
at RDFCFTree.cpp:1302
#14 0x000000000041ffd0 in RDFCFTree::closedExtensionExplore (
this=this@entry=0x67bbd0, frequency=..., outFile=..., database=...,
occList=..., frequent2Tree=..., headIndex=...,
threshold=@0x7fffffffd818: 6, checked=..., closed=..., maximal=...)
at RDFCFTree.cpp:1302
#15 0x000000000041ffd0 in RDFCFTree::closedExtensionExplore (this=0x6f0ac0,
frequency=..., outFile=..., database=..., occList=..., frequent2Tree=...,
headIndex=..., threshold=@0x7fffffffd818: 6, checked=..., closed=...,
maximal=...) at RDFCFTree.cpp:1302
#16 0x0000000000405252 in RFrequentTreeList::extensionExploreList4 (
this=0x7fffffffd8c0, database=..., outFile=..., frequency=...,
threshold=@0x7fffffffd818: 6, checked=..., closed=..., maximal=...)
at RFrequentTreeList.cpp:248
#17 0x0000000000401fd0 in main (argc=, argv=)
at CMTreeMiner.cpp:112
这是RDFCFTree的构造函数:
RDFCFTree::RDFCFTree(const RDFCFTree& parent,
short newEdgeLabel, short newVertexLabel, short position)
{
/******************************************************************
idea: copy the tree structure of the parent, plus one new leg
Note: use deep copy and preserve the original order of link list
at the end, recompute the DFCS and automorphisms
******************************************************************/
vCount = parent.vCount + 1;
tid = parent.tid;
adj.resize(vCount + 1);
TnodeLink t1, t2, t3;
for ( short i = 1; i <= vCount - 1; i++ ) //copy the parent part here
{
t1 = parent.adj[i];
if ( t1 == 0 ) //unlike to happen for a tree
{
adj[i] = 0;
continue;
}
else
{
t2 = new Tnode(*t1);
adj[i] = t2;
while ( t1->next != 0 )
{
t1 = t1->next;
t3 = new Tnode(*t1);
t2->next = t3;
t2 = t3;
}
}
}
vertexLabel = parent.vertexLabel;
vertexLabel.push_back(newVertexLabel);
degree = parent.degree;
degree.push_back(0);
level = parent.level;
level.push_back(level[position]+1);
insertEdge(Edge(position,vCount,newEdgeLabel));
automorphism.resize(vCount+1);
computeDFCS();
computeAutomorphism();
}
这是 closedExtensionExplore 函数:
void RDFCFTree::closedExtensionExplore( vector<long>&frequency,
ostream & outFile,
const vector<ptrRFreeTree>& database,
const vector<Occurrence> & occList,
const vector< vector<short> > & frequent2Tree,
const vector<long> & headIndex,
const long & threshold,
vector<long> & checked,
vector<long> & closed,
vector<long> & maximal)
{
/******************************************************************
step0: output this tree
******************************************************************/
checked[vCount]++;
TnodeLink t;
/******************************************************************
step1: using occurrence-match pruning
******************************************************************/
/******************************************************************
step1.1: initialize the parent from the first occurrence
******************************************************************/
short parentVertex, parentEdge;
bool sameParent = true;
if ( occList[0].nodeIndex[0] == 1 ) //if the first occurrence's root
//is the root of the transaction
sameParent = false;
else
{
t = database[occList[0].tid]->adj[occList[0].nodeIndex[0]];
while ( t->next != 0 ) t = t->next;
parentEdge = t->eLabel;
parentVertex = database[occList[0].tid]->vertexLabel[t->v];
}
/******************************************************************
step1.2: use other occurrences to compute the intersections of parents
******************************************************************/
for ( long s = 1; s < occList.size(); s++ )
{
short tempEdge, tempVertex;
if ( occList[s].nodeIndex[0] == 1 ) //if the occurrence's root
//is the root of the transaction
sameParent = false;
else
{
t = database[occList[s].tid]->adj[occList[s].nodeIndex[0]];
while ( t->next != 0 ) t = t->next;
tempEdge = t->eLabel;
tempVertex = database[occList[s].tid]->vertexLabel[t->v];
if ( tempEdge != parentEdge || tempVertex != parentVertex )
sameParent = false;
}
if ( sameParent == false ) break;
}
//parent-pruning
if ( sameParent == true ) return;
/******************************************************************
step1.3: find the locations where a new leg can grow
******************************************************************/
vector<short> positionToExplore;
if ( vCount != 1 ) //be careful! For a single-vertex tree, adj[j] = empty
{
short j = 1;
while ( level[j] == 1 || degree[j] > 1 )
{
positionToExplore.push_back(j);
j = adj[j]->v;
}
positionToExplore.push_back(j);
}
else
positionToExplore.push_back(1);
/******************************************************************
step1.4: compute the range of labels for each vertex
******************************************************************/
vector<short> vertexRange(vCount + 1, MAX_VERTEX + 1);
vector<short> edgeRange(vCount + 1, MAX_EDGE + 1);
for ( short j = 0; j < positionToExplore.size(); j++ )
{
short i = positionToExplore[j];
possibleLegs(i, edgeRange[i], vertexRange[i]);
}
/******************************************************************
step1.5: initialize the list of legs from the first occurrence
******************************************************************/
vector<short> legTriple(3); //vertex index, leg edge label, leg vertex label
vector<vector<short> > commonLegs;
set<short> neighbors; //
set<short>::iterator pos;
for ( short i = 1; i <= vCount; i++ )
{
neighbors.clear();
t = adj[i];
while ( t != 0 ) //insert index of all neighbors of the position i
{
neighbors.insert(occList[0].nodeIndex[t->v - 1]);//inconsistency on index
t = t->next;
}
t = database[occList[0].tid]->adj[occList[0].nodeIndex[i-1]];
while ( t != 0 )
{
if ( occList[0].nodeIndex[i-1] < t->v )
{
pos = neighbors.find( t->v );
if ( pos == neighbors.end() ) //if the vertex hasn't been used
{
legTriple[0] = i;
legTriple[1] = t->eLabel;
legTriple[2] = database[occList[0].tid]->vertexLabel[t->v];
commonLegs.push_back(legTriple);
}
}
t = t->next;
}//end of while ( t != 0 )
}
/******************************************************************
step1.6: use other occurrences to compute the intersections of legs
******************************************************************/
for ( long s = 1; s < occList.size(); s++ )
{
vector<bool> isFetched(vCount + 1, false);
vector<vector<short> > tupleLegs(0);
vector<short> legEVPair(2);
vector<vector<short> >::iterator pos1;
for ( pos1 = commonLegs.begin(); pos1 != commonLegs.end(); )
{
vector<short> thisTriple = *pos1; //get the next commonLeg
//debug
//cout << commonLegs.size() << endl;
//cout << thisTriple[0] << ' ' << thisTriple[1] << ' ' << thisTriple[2] << endl;
short i = thisTriple[0]; //the index of vertex
//assuming the indices in the commonLegs are non-decreasing
if ( !isFetched[i] ) //fetch all neighbors of the vertex in the
//corresponding database transaction
{
neighbors.clear();
tupleLegs.resize(0);
t = adj[i];
while ( t != 0 ) //insert index of all neighbors of the position i
{
neighbors.insert(occList[s].nodeIndex[t->v - 1]);//inconsistency on index
t = t->next;
}
t = database[occList[s].tid]->adj[occList[s].nodeIndex[i-1]];
while ( t != 0 )
{
if ( occList[s].nodeIndex[i-1] < t->v )
{
pos = neighbors.find( t->v );
if ( pos == neighbors.end() ) //if the vertex hasn't been used
{
legEVPair[0] = t->eLabel;
legEVPair[1] = database[occList[s].tid]->vertexLabel[t->v];
tupleLegs.push_back(legEVPair);
}
}
t = t->next;
}
isFetched[i] = true;
}
bool isFound = false;
for ( short k = 0; k < tupleLegs.size(); k++ )
{
if ( thisTriple[1] == tupleLegs[k][0] && thisTriple[2] == tupleLegs[k][1] )
{
isFound = true;
break;
}
}
if ( !isFound )
{
pos1 = commonLegs.erase(pos1);
}
else
{
++pos1;
}
}
if ( commonLegs.size() == 0 ) break;
}
if ( commonLegs.size() != 0 )
{
set<short> positionSet;
for ( short i = 0; i < positionToExplore.size(); i++ )
positionSet.insert(positionToExplore[i]);
for ( short i = 0; i < commonLegs.size(); i++ )
{
pos = positionSet.find(commonLegs[i][0]);
if ( pos == positionSet.end() ) //not on the rightmost path
{
return;
}
else
{
short j = commonLegs[i][0];
if ( (commonLegs[i][1] < edgeRange[j]) ||
((commonLegs[i][1] == edgeRange[j]) && (commonLegs[i][2] < vertexRange[j])) )
return;
}
}
}
bool isClosed = true;
bool isMaximal = true;
/******************************************************************
step2: check if this tree is closed
******************************************************************/
while ( true )
{
/******************************************************************
step2.1: if from the previous step, there are common legs, then not closed
******************************************************************/
if ( commonLegs.size() != 0 )
{
isClosed = false;
isMaximal = false;
break;
}
/******************************************************************
step2.2: get the list of parents of the first tid
******************************************************************/
vector< vector<short> > candidateParent;
vector<short> parentPair(2,0); //parentEdge, then parentVertex
sameParent = true;
long m = 0;
long n = 0;
long tempTid = occList[0].tid;
while ( m < occList.size() && occList[m].tid == tempTid )
{
if ( occList[m].nodeIndex[0] != 1 )
//if the first occurrence's root
//is not the root of the transaction
{
t = database[occList[m].tid]->adj[occList[m].nodeIndex[0]];
while ( t->next != 0 ) t = t->next;
parentPair[0] = t->eLabel;
parentPair[1] = database[occList[m].tid]->vertexLabel[t->v];
candidateParent.push_back(parentPair);
}
m++;
}
//now candidateParent holds all possible parents
/******************************************************************
step2.3: use other transactions to compute the intersections of parents
******************************************************************/
if ( candidateParent.size() == 0 )
{
sameParent = false;
}
else
{
while ( m < occList.size() && candidateParent.size() != 0 )
{
n = m;
short tempEdge, tempVertex;
while ( n < occList.size() && occList[n].tid == occList[m].tid )
n++;
n--;
vector < vector<short> >::iterator pos1;
for ( pos1 = candidateParent.begin(); pos1 != candidateParent.end(); )
{
bool tempFlag = false;
for ( long s = m; s <= n; s++ )
{
if ( occList[s].nodeIndex[0] != 1 )
{
t = database[occList[s].tid]->adj[occList[s].nodeIndex[0]];
while ( t->next != 0 ) t = t->next;
tempEdge = t->eLabel;
tempVertex = database[occList[s].tid]->vertexLabel[t->v];
if ( tempEdge == (*pos1)[0] && tempVertex == (*pos1)[1] )
{
tempFlag = true;
break; //break the for loop: for ( s = m; ... )
}
}
}
if ( tempFlag == true ) ++pos1;
else pos1 = candidateParent.erase(pos1);
}
m = n+1;
}//end of while ( m < ... )
}
//parent-closed-checking
if ( candidateParent.size() == 0 )
sameParent = false;
if ( sameParent == true )
{
isClosed = false;
isMaximal = false;
break;
}
/******************************************************************
step2.4: get the list of legs of the first tid
******************************************************************/
commonLegs.clear();
m = 0;
n = 0;
tempTid = occList[0].tid;
while ( n < occList.size() && occList[n].tid == tempTid )
n++;
n--;
for ( short i = 1; i <= vCount; i++ )
{
for ( long s = m; s <= n; s++ )
{
neighbors.clear();
t = adj[i];
while ( t != 0 ) //insert index of all neighbors of the position i
{
neighbors.insert(occList[s].nodeIndex[t->v - 1]);//inconsistency on index
t = t->next;
}
t = database[occList[s].tid]->adj[occList[s].nodeIndex[i-1]];
while ( t != 0 )
{
if ( occList[s].nodeIndex[i-1] < t->v )
{
pos = neighbors.find( t->v );
if ( pos == neighbors.end() ) //if the vertex hasn't been used
{
legTriple[0] = i;
legTriple[1] = t->eLabel;
legTriple[2] = database[occList[s].tid]->vertexLabel[t->v];
commonLegs.push_back(legTriple);
}
}
t = t->next;
}//end of while ( t != 0 )
}//end of for ( long s = m; ... )
}
//now commonLegs stores all possible new legs
/******************************************************************
step2.5: using other transactions to prune commonLegs
******************************************************************/
m = n+1; //next tid
while ( m < occList.size() && commonLegs.size() != 0 )
{
n = m+1;
while ( n < occList.size() && occList[n].tid == occList[m].tid )
n++;
n--; //now from m to n are the occurrences sharing the same tid
vector<bool> isFetched(vCount + 1, false);
vector<vector<short> > tupleLegs(0);
vector<short> legEVPair(2);
vector<vector<short> >::iterator pos1;
for ( pos1 = commonLegs.begin(); pos1 != commonLegs.end(); )
{
vector<short> thisTriple = *pos1; //get the next commonLeg
short i = thisTriple[0]; //the index of vertex
//assuming the indices in the commonLegs are non-decreasing
if ( !isFetched[i] ) //fetch all neighbors of the vertex in the
//corresponding database transaction
{
tupleLegs.resize(0);
for ( long s = m; s <= n; s++ )
{
neighbors.clear();
t = adj[i];
while ( t != 0 ) //insert index of all neighbors of the position i
{
neighbors.insert(occList[s].nodeIndex[t->v - 1]);//inconsistency on index
t = t->next;
}
t = database[occList[s].tid]->adj[occList[s].nodeIndex[i-1]];
while ( t != 0 )
{
if ( occList[s].nodeIndex[i-1] < t->v )
{
pos = neighbors.find( t->v );
if ( pos == neighbors.end() ) //if the vertex hasn't been used
{
legEVPair[0] = t->eLabel;
legEVPair[1] = database[occList[s].tid]->vertexLabel[t->v];
tupleLegs.push_back(legEVPair);
}
}
t = t->next;
}
}//end of for ( long s = m; ... )
isFetched[i] = true;
}
bool isFound = false;
for ( short k = 0; k < tupleLegs.size(); k++ )
{
if ( thisTriple[1] == tupleLegs[k][0] && thisTriple[2] == tupleLegs[k][1] )
{
isFound = true;
break;
}
}
if ( !isFound )
{
pos1 = commonLegs.erase(pos1);
}
else
{
++pos1;
}
}
if ( commonLegs.size() == 0 ) break;
m = n+1;
}//end of while ( m < ... )
if ( commonLegs.size() != 0 )
{
isClosed = false;
isMaximal = false;
break;
}
break;
}//end of while at the very beginning of step2
if ( isClosed == true ) closed[vCount]++;
/******************************************************************
step3: main loop, for each position, explore
******************************************************************/
for ( short j = 0; j < positionToExplore.size(); j++ )
{
short i = positionToExplore[j];
//step3_1: get the range of valid legs
short minEdge = edgeRange[i];
short minVertex = vertexRange[i];
//if there is no possible leg at this position
if ( minEdge > MAX_EDGE ) continue; //continue the for loop
//if there is no frequent 2-tree starting from this vertex label
if ( headIndex[vertexLabel[i] - MIN_VERTEX] == 0 ) continue;
//step3_2: get the possible frequent legs
vector<bool> isFrequent( (MAX_EDGE - MIN_EDGE + 1)
*(MAX_VERTEX - MIN_VERTEX + 1), false);
for (short j = headIndex[vertexLabel[i] - MIN_VERTEX];
(j < frequent2Tree.size() && frequent2Tree[j][0] == vertexLabel[i]); j++ )
isFrequent[( frequent2Tree[j][1] - MIN_EDGE ) * ( MAX_VERTEX - MIN_VERTEX + 1 )
+ ( frequent2Tree[j][2] - MIN_VERTEX )] = true;
//step2_3: explore each potential leg
Occurrence tempOcc;
vector<SupportNode> potential((MAX_EDGE - MIN_EDGE + 1)
*(MAX_VERTEX - MIN_VERTEX + 1));
for ( long s = 0; s < occList.size(); s++ )
{
neighbors.clear();
t = adj[i];
while ( t != 0 ) //insert index of all neighbors of the position i
{
neighbors.insert(occList[s].nodeIndex[t->v - 1]);//inconsistency on index
t = t->next;
}
t = database[occList[s].tid]->adj[occList[s].nodeIndex[i-1]];
while ( t != 0 )
{
if ( occList[s].nodeIndex[i-1] < t->v )
{
pos = neighbors.find( t->v );
if ( pos == neighbors.end() ) //if the vertex hasn't been used
{
short tempE = t->eLabel;
short tempV = database[occList[s].tid]->vertexLabel[t->v];
short location = ( tempE - MIN_EDGE ) * ( MAX_VERTEX - MIN_VERTEX + 1 )
+ ( tempV - MIN_VERTEX );
if ( ((tempE > minEdge) || (tempE == minEdge && tempV >= minVertex)) &&
isFrequent[location] ) //if the leg is potentially frequent
{
tempOcc = occList[s];
tempOcc.nodeIndex.push_back(t->v);
**potential[location].occList.push_back(tempOcc);**
if ( tempOcc.tid != potential[location].lastTid )
{
potential[location].lastTid = tempOcc.tid;
potential[location].support++;
}
}
}
}
t = t->next;
}//end of while ( t != 0 )
}//end of for ( s = 0; ...)
for ( long s = 0; s < potential.size(); s++ )
{
if ( potential[s].support >= threshold )
{
isMaximal = false; //this tree cannot be maximal
short tempE = MIN_EDGE + (short)(floor(s/(MAX_VERTEX - MIN_VERTEX + 1)));
short tempV = MIN_VERTEX + (s % (MAX_VERTEX - MIN_VERTEX + 1));
RDFCFTree *pbfcf = new RDFCFTree(*this,tempE,tempV,i);
pbfcf->closedExtensionExplore(frequency, outFile, database,potential[s].occList,
frequent2Tree,headIndex,threshold, checked, closed, maximal);
delete pbfcf;
}
}
////test
//cout << "leg position is: " << i << " vertex label is: " << vertexLabel[i] << endl;
//cout << "min edge and min vertex are: " << minEdge << ' ' << minVertex << endl;
//for ( j = 0; j < isFrequent.size(); j++ )
// cout << isFrequent[j] << ' ';
//cout << endl;
//cout << endl;
}//end of for(short j = ...)
/******************************************************************
step4: check if this tree is maximal
******************************************************************/
/******************************************************************
step4.1: if determined from the previous step not maximal
******************************************************************/
if ( isClosed == false || isMaximal == false) return;
/******************************************************************
step4.2: check the frequent parents
******************************************************************/
vector<long> tempVector(MAX_VERTEX-MIN_VERTEX+1,0);
vector < vector <long> > countingMatrix(MAX_EDGE-MIN_EDGE+1,tempVector);
long m = 0;
long n = 0;
while ( m < occList.size() )
{
n = m+1;
while ( n < occList.size() && occList[n].tid == occList[m].tid )
n++;
n--;
set<pair<short,short> > parentEVPairs;
short tempEdge, tempVertex;
for ( long s = m; s <= n; s++ )
{
if ( occList[s].nodeIndex[0] != 1 )
//if the first occurrence's root
//is not the root of the transaction
{
t = database[occList[s].tid]->adj[occList[s].nodeIndex[0]];
while ( t->next != 0 ) t = t->next;
tempEdge = t->eLabel;
tempVertex = database[occList[s].tid]->vertexLabel[t->v];
parentEVPairs.insert(make_pair(tempEdge,tempVertex));
}
}
set<pair<short,short> >::iterator pos2;
for ( pos2 = parentEVPairs.begin(); pos2 != parentEVPairs.end(); ++pos2 )
countingMatrix[pos2->first - MIN_EDGE][pos2->second - MIN_VERTEX]++;
m = n+1;
}//end of while ( m < ... )
bool tempFlag = false;
for ( short i = 0; i < MAX_EDGE-MIN_EDGE+1; i++ )
{
if ( tempFlag == false )
{
for ( short j = 0; j < MAX_VERTEX - MIN_VERTEX+1; j++ )
{
if ( countingMatrix[i][j] >= threshold )
{
tempFlag = true;
break;
}
}
}
else
break;
}
if ( tempFlag == true ) //not maximal
{
isMaximal = false;
return;
}
/******************************************************************
step4.3: check the frequent new legs, at any place
******************************************************************/
for ( short i = 1; i <= vCount; i++ )
{
vector<long> tempVector2(MAX_VERTEX-MIN_VERTEX+1,0);
vector < vector <long> > countingMatrix2(MAX_EDGE-MIN_EDGE+1,tempVector2);
long m = 0;
long n = 0;
while ( m < occList.size() )
{
n = m+1;
while ( n < occList.size() && occList[n].tid == occList[m].tid )
n++;
n--;
set<pair<short,short> > legEVPairs;
short tempEdge2, tempVertex2;
for ( long s = m; s <= n; s++ )
{
neighbors.clear();
t = adj[i];
while ( t != 0 ) //insert index of all neighbors of the position i
{
neighbors.insert(occList[s].nodeIndex[t->v - 1]);//inconsistency on index
t = t->next;
}
t = database[occList[s].tid]->adj[occList[s].nodeIndex[i-1]];
while ( t != 0 )
{
if ( occList[s].nodeIndex[i-1] < t->v )
{
pos = neighbors.find( t->v );
if ( pos == neighbors.end() ) //if the vertex hasn't been used
{
tempEdge2 = t->eLabel;
tempVertex2 = database[occList[s].tid]->vertexLabel[t->v];
legEVPairs.insert(make_pair(tempEdge2,tempVertex2));
}
}
t = t->next;
}
}//end of for ( long s = m; ... )
set<pair<short,short> >::iterator pos2;
for ( pos2 = legEVPairs.begin(); pos2 != legEVPairs.end(); ++pos2 )
countingMatrix2[pos2->first - MIN_EDGE][pos2->second - MIN_VERTEX]++;
m = n+1;
}//end of while ( m < ... )
bool tempFlag2 = false;
for ( short k = 0; k < MAX_EDGE-MIN_EDGE+1; k++ )
{
if ( tempFlag2 == false )
{
for ( short j = 0; j < MAX_VERTEX - MIN_VERTEX+1; j++ )
{
if ( countingMatrix2[k][j] >= threshold )
{
tempFlag2 = true;
break;
}
}
}
else
break;
}
if ( tempFlag2 == true ) //not maximal
{
isMaximal = false;
return;
}
}//end of for ( short i ... )
if ( isMaximal == true ) maximal[vCount]++;
//cout << *this;
//cout << "support is: " << occList.size() << endl << endl;
/*
}
我怎样才能知道是什么原因导致了这个问题?哪个变量?非常感谢
最佳答案
您似乎正在尝试创建一个包含 67,108,864 个元素的 vector 。这失败了,因为生成的分配请求大得不合理。
i'll try increasing stack/heap limit with "ulimit -s unlimited"
这不太可能有帮助(它不会使分配请求变小)。
您是否期望您的 vector 如此大?如果不是,则需要查找算法中的错误。
更新:
how do you see the length of the vector?
您可以在 GDB 输出中看到:
#7 0x000000000040bfdb in allocate (__n=67108864, this=)
yes it is possible that the array becomes so large because it's a mining algorithm. what can i do?
我不知道你正在push_back
进入的 vector 类型是什么(你似乎搞砸了剪切/粘贴,或者编辑了 GDB 回溯,和 没有告诉我们哪一行是 1280 行)。很有可能,元素大小非常大。您可能必须在 vector 中存储指向元素的指针,而不是元素本身。
关于c++ - 来自 libc.so.6 C++ 的 bad_alloc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22963844/
#include using namespace std; class C{ private: int value; public: C(){ value = 0;
这个问题已经有答案了: What is the difference between char a[] = ?string?; and char *p = ?string?;? (8 个回答) 已关闭
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 7 年前。 此帖子已于 8 个月
除了调试之外,是否有任何针对 c、c++ 或 c# 的测试工具,其工作原理类似于将独立函数复制粘贴到某个文本框,然后在其他文本框中输入参数? 最佳答案 也许您会考虑单元测试。我推荐你谷歌测试和谷歌模拟
我想在第二台显示器中移动一个窗口 (HWND)。问题是我尝试了很多方法,例如将分辨率加倍或输入负值,但它永远无法将窗口放在我的第二台显示器上。 关于如何在 C/C++/c# 中执行此操作的任何线索 最
我正在寻找 C/C++/C## 中不同类型 DES 的现有实现。我的运行平台是Windows XP/Vista/7。 我正在尝试编写一个 C# 程序,它将使用 DES 算法进行加密和解密。我需要一些实
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
有没有办法强制将另一个 窗口置于顶部? 不是应用程序的窗口,而是另一个已经在系统上运行的窗口。 (Windows, C/C++/C#) 最佳答案 SetWindowPos(that_window_ha
假设您可以在 C/C++ 或 Csharp 之间做出选择,并且您打算在 Windows 和 Linux 服务器上运行同一服务器的多个实例,那么构建套接字服务器应用程序的最明智选择是什么? 最佳答案 如
你们能告诉我它们之间的区别吗? 顺便问一下,有什么叫C++库或C库的吗? 最佳答案 C++ 标准库 和 C 标准库 是 C++ 和 C 标准定义的库,提供给 C++ 和 C 程序使用。那是那些词的共同
下面的测试代码,我将输出信息放在注释中。我使用的是 gcc 4.8.5 和 Centos 7.2。 #include #include class C { public:
很难说出这里问的是什么。这个问题是含糊的、模糊的、不完整的、过于宽泛的或修辞性的,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开它,visit the help center 。 已关
我的客户将使用名为 annoucement 的结构/类与客户通信。我想我会用 C++ 编写服务器。会有很多不同的类继承annoucement。我的问题是通过网络将这些类发送给客户端 我想也许我应该使用
我在 C# 中有以下函数: public Matrix ConcatDescriptors(IList> descriptors) { int cols = descriptors[0].Co
我有一个项目要编写一个函数来对某些数据执行某些操作。我可以用 C/C++ 编写代码,但我不想与雇主共享该函数的代码。相反,我只想让他有权在他自己的代码中调用该函数。是否可以?我想到了这两种方法 - 在
我使用的是编写糟糕的第 3 方 (C/C++) Api。我从托管代码(C++/CLI)中使用它。有时会出现“访问冲突错误”。这使整个应用程序崩溃。我知道我无法处理这些错误[如果指针访问非法内存位置等,
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 7 年前。
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,因为
我有一些 C 代码,将使用 P/Invoke 从 C# 调用。我正在尝试为这个 C 函数定义一个 C# 等效项。 SomeData* DoSomething(); struct SomeData {
这个问题已经有答案了: Why are these constructs using pre and post-increment undefined behavior? (14 个回答) 已关闭 6
我是一名优秀的程序员,十分优秀!