Ticket #383 (closed defect: duplicate)

Opened 3 years ago

Last modified 18 months ago

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 }

Attachments

1.rar Download (208.2 KB) - added by atubar 3 years ago.

Change History

follow-up: ↓ 4   Changed 3 years ago by strk

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 !

Changed 3 years ago by atubar

  Changed 3 years ago by strk

See also #384 for another such case

  Changed 3 years ago by strk

  • summary changed from error occur when buffer to huge memory cost and crash in buffer

in reply to: ↑ 1   Changed 3 years ago by atubar

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

follow-up: ↓ 6   Changed 3 years ago by strk

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   Changed 3 years ago by atubar

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?

follow-up: ↓ 8   Changed 3 years ago by strk

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

in reply to: ↑ 7   Changed 3 years ago by atubar

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?

  Changed 23 months ago by strk

  • keywords buffer added
  • version changed from 3.2.0 to svn-trunk
  • milestone changed from 3.2.1 to GEOS Future

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.

  Changed 20 months ago by strk

  • summary changed from huge memory cost and crash in buffer to huge memory cost and crash in buffer [JTS fails too]
  • milestone changed from GEOS Future to 3.4.0

  Changed 18 months ago by strk

  • keywords jtsfail added

See also #502 for another case of this bug

  Changed 18 months ago by strk

  • status changed from new to closed
  • resolution set to duplicate

This is actually a duplicate of #344

Note: See TracTickets for help on using tickets.