Opened 13 years ago

Closed 12 years ago

#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: main
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 }

Attachments (2)

1.rar (208.2 KB ) - added by atubar 13 years ago.
geos-383-shp.zip (243.1 KB ) - added by mdavis 3 years ago.
Geometry causing error for buffer distance = -8665

Download all attachments as: .zip

Change History (14)

comment:1 by strk, 13 years ago

Print edgeList.size() as first thing on function enter. Also, check the callers. Finally attach your input as WKT or WKB. Chances are your input geometry is just too big...

Ah, don't forget to try with current development version !

by atubar, 13 years ago

Attachment: 1.rar added

comment:2 by strk, 13 years ago

See also #384 for another such case

comment:3 by strk, 13 years ago

Summary: error occur when bufferhuge memory cost and crash in buffer

in reply to:  1 comment:4 by atubar, 13 years ago

So if the geometry is too big, how to solve the problem? and where can I find out the limit size of the geometry?

comment:5 by strk, 13 years ago

I haven't checked your geometry yet. Anyway, if it's a multi-component try applying the buffer to each component in turn.

in reply to:  5 comment:6 by atubar, 13 years ago

I have attach a ticket, a shapefile with only a entity. when buffering, with the shapefile in the ticket and a distance of -8665. Can you have a test, and show us a solution?

comment:7 by strk, 13 years ago

I cannot look at it shortly, sorry (unless you can buy me some time).

in reply to:  7 comment:8 by atubar, 13 years ago

We need to do buffer operation in our program. Often the single geometry is huge, and the shapefile is big and contain many geometry. So what's the best way that you can show us?

comment:9 by strk, 13 years ago

Keywords: buffer added
Milestone: 3.2.1GEOS Future
Version: 3.2.0svn-trunk

this is an issue with the buffer algorithm itself (from JTS). A possible solution could be splitting the line in smaller portions, buffer each one in turn and then finally union them togheter.

It is still an issue with trunk and won't be changed in 3.2, so changing the milestone.

comment:10 by strk, 13 years ago

Milestone: GEOS Future3.4.0
Summary: huge memory cost and crash in bufferhuge memory cost and crash in buffer [JTS fails too]

comment:11 by strk, 12 years ago

Keywords: jtsfail added

See also #502 for another case of this bug

comment:12 by strk, 12 years ago

Resolution: duplicate
Status: newclosed

This is actually a duplicate of #344

by mdavis, 3 years ago

Attachment: geos-383-shp.zip added

Geometry causing error for buffer distance = -8665

Note: See TracTickets for help on using tickets.