Ticket #383 (closed defect: duplicate)
huge memory cost and crash in buffer [JTS fails too]
| Reported by: | atubar | Owned by: | geos-devel@… |
|---|---|---|---|
| Priority: | major | Milestone: | 3.4.0 |
| Component: | Default | Version: | svn-trunk |
| Severity: | Unassigned | Keywords: | buffer jtsfail |
| Cc: |
Description
we debug the source code, and find that this function cause huge memory cost, especially of the 'for' circulation.
void SegmentNodeList::addSplitEdges(std::vector<SegmentString?*>& edgeList) {
// testingOnly
#if GEOS_DEBUG
std::cerr<<FUNCTION<<" entered"<<std::endl; std::vector<SegmentString?*> testingSplitEdges;
#endif
// ensure that the list has entries for the first and last // point of the edge addEndpoints(); addCollapsedNodes();
// there should always be at least two entries in the list // since the endpoints are nodes iterator it=begin(); SegmentNode? *eiPrev=*it; assert(eiPrev); it++;
//problem occurs here for(iterator itEnd=end(); it!=itEnd; ++it) { //&&&&This circulation consumes lots of memory so as to run out of the memory,then the program collapse
SegmentNode? *ei=*it; assert(ei);
if ( ! ei->compareTo(*eiPrev) ) continue;
SegmentString? *newEdge=createSplitEdge(eiPrev, ei); edgeList.push_back(newEdge);
#if GEOS_DEBUG
testingSplitEdges.push_back(newEdge);
#endif
eiPrev = ei;
}
#if GEOS_DEBUG
std::cerr<<FUNCTION<<" finished, now checking correctness"<<std::endl; checkSplitEdgesCorrectness(testingSplitEdges);
#endif }

