[pgrouting-users] PostGIS - Problem with driving_distance segfault when calculating distance for many nodes

Weninger Kurt kurt.weninger at utanet.at
Tue Aug 30 15:04:16 EDT 2011

Hi !

I am calculating the shortest paths for some nodes of a large network with
about 600.000 nodes and edges. Building network topology works fine, also
computing the distance for one node.
The problem I am encountering occurs when I am trying to calculate the
shortest path matrix for several selected nodes (about 1000) at once. I am
calling the function for each node and as I also have reverse costs are
getting the resulting matrix.
Problem is that I get a segfault in librouting_dd.so after ~ 170 nodes in
Windows and ~ 300 nodes in Linux. The backtrace leads me to line 162 of
When I am doing the calculation in pieces of 100 nodes and logging out
between calculations everything works fine.

I think the problem is using malloc to reserve memory, as I observed
increasing memory usage of process postgres.

  *path = (path_element_t *) malloc( sizeof(path_element_t) *
                                     (path_vector.size() + 1) );

It seems to me the memory is never freed.
Can this be solved using palloc ?  And how ?  Because I tried changing
malloc to palloc, but getting strange errors in other libraries

Thanks for your help,


More information about the Pgrouting-users mailing list