Boost logo

Boost Users :

Subject: [Boost-users] [BGL] memory leak in graph/r_c_shortest_paths.hpp
From: potato_research (santini.alberto_at_[hidden])
Date: 2013-09-23 04:24:56


Hello,

I'm using BGL in my project and, with some input data, I get - sooner or
later, as I run r_c_shortest_paths many times - a segfault.

This behaviour is apparently quite random, as I can see by implementing a
custom visitor that the last label evaluated before the crash changes all
the time. I must also say that the graph I use, while always having the same
topological structure, has different properties that affect labelling each
time I run the algorithm and these vary quite randomly from one run to the
other, as they are generated by a random heuristics.

Anyway, with one particular set of input data, I manage to have the program
segfault (as I said, sooner or later) 100% of the times. This is far from
being an MWE, but it's the best I could produce.

I tried to debug the memory leak with valgrind and it turns out that
r_c_shortest_paths_dispatch is trying to access memory in a block previously
freed by:

l_alloc.deallocate( cur_outer_splabel.get(), 1 );

in r_c_shortest_paths.hpp:314. After some debugging I started to believe
that the problem doesn't rely with my code, but it might be a bug in
r_c_shortest_paths.hpp. If this is actually the case and where the problem
lies, though, I haven't been able to figure out with certainty.

The output from valgrind can be found here:
http://pastebin.com/raw.php?i=WWafwFv3 (output cleaned up and with templates
substituted)
http://pastebin.com/raw.php?i=cb3p6jzM (raw output intended to facilitate
reading and with templates substituted)
http://pastebin.com/raw.php?i=qeauBQTm (raw output indented to facilitate
reading)
http://pastebin.com/raw.php?i=hpppf49c (raw output)

My code (the whole project) can be found here:
https://github.com/alberto-santini/maritime-vrp

In order to run it, one must have a licensed copy of CPLEX and change the
include and library paths in the Makefile's accordingly. Unfortunately,
without putting the labelling part inside a price-and-branch procedure (that
uses CPLEX as a solver for the master problem) I wasn't able to produce
input data by hand that would lead me to obtain the segfault.

I understand this is not the best way to investigate into a bug and will be
happy to provide any further help if requested to.

Thanks,
AS

--
View this message in context: http://boost.2283326.n4.nabble.com/BGL-memory-leak-in-graph-r-c-shortest-paths-hpp-tp4651836.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net