[pgrouting-dev] Fixes for Bidirectional code just checked in

Alec Gosse alec at thegosses.com
Tue Jun 4 12:53:27 PDT 2013


Hello,

I've just pulled from the develop branch and built fresh and I'm getting a server crash from pgr_bdastar. If I run exactly the same thing using pgr_astar, it works. This is using postgres 9.2.4 and postgis 2.0.3 from Homebrew on Mac 10.8.3

I'm still working on a bulk routing function using bdastar, but just realized that the regular version was crashing without my modifications. I'm happy to try to track this down, but have little knowledge of how to debug within postgresql. Any pointers would be appreciated.

Best,
Alec




On Jun 1, 2013, at 2:13 PM, Stephen Woodbridge <woodbri at swoodbridge.com> wrote:

> Hi all,
> 
> I think I have just submitted changes to the bidirectional dijkstra and astar routines the resolve the server crashes we were seeing. This closes on major outstanding bug against 2.0.
> 
> Razequl,
> 
> I made two simple changes to your code BiDirDijkstra.cpp and the astar version:
> 
> 1. in BiDirDijkstra::initall I add:
>    m_vecNodeVector.reserve(maxNode + 1);
> 
> 2. in BiDirDijkstra::bidir_dijkstra I move the call to initall(maxNode); to before construct_graph(edges, edge_count, maxNode);
> 
> This does two major things:
> 
> 1. std::vector doubles the size of the array every time it needs to increase its size and then needs to copy the old data to the new area.
> 
> 2. reserve() pre allocates all the memory we need once, which avoid realloc memory fragmentation and avoids the copy each time it reallocs so this improves performance.
> 
> Anytime you know how much space you are going to need you should reserve it up front.
> 
> So things look good for now.
> 
> Thanks,
>  -Steve
> _______________________________________________
> pgrouting-dev mailing list
> pgrouting-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-dev



More information about the pgrouting-dev mailing list