bad_alloc из libc.so.6 C++

Я запускаю программу на C++ под gdb в 64-битную оперативную память Debian 7 на 64 ГБ, и я столкнулся с проблемой 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;
    /*
}

Как я могу понять, что вызывает эту проблему? какая переменная? огромное спасибо

1 ответ

Похоже, вы пытаетесь создать вектор с 67,108,864 элементами. Это не удается, потому что результирующий запрос на выделение неоправданно велик.

я попытаюсь увеличить лимит стека / кучи с помощью "ulimit -s unlimited"

Это вряд ли поможет (это не сделает запрос на выделение памяти меньше).

Вы ожидаете, что ваш вектор будет таким большим? Если нет, вам нужно искать ошибку в вашем алгоритме.

Обновить:

как вы видите длину вектора?

Вы можете видеть это в выводе GDB:

#7 0x000000000040bfdb in allocate (__n=67108864, this=)

да, возможно, массив становится настолько большим, потому что это алгоритм майнинга. Что я могу сделать?

I can't tell what is the type of the vector you are push_backing into (you appear to have screwed up cut/paste, or edited the GDB backtrace, and didn't tell us which line is line 1280). Chances are, the element size is quite large. You may have to store pointers to elements in the vector, instead of elements themselves.

Другие вопросы по тегам