
Sorry for the duplicate. I hit a weird set of key strokes and the email
was sent.
I have a class which is containing a shared_ptr to data. This class
parses in a XML file and populates the data based upon the contents.
There is a memory problem in this file where I reset the shared_ptr.
Am I right in interpreting the output of valgrind that the problem is at
Line 110 in Formula_Parser.cpp or is it somewhere else? I thought it was
in Formula_Parser.cpp so I printed out here what is happening in the
function. I am trying to create a Graph pointer where data will be added
to it when the XML parser calls back endElement. So I cannot pass the
pointer to the graph as a part of the XML calls without editing that
library. So I made it a member variable to the class. The idea is that
the Graph is populated with Components and then returned at the end of
parse(). Am I correctly resetting m_graph?
Stephen
----------------
class Graph;
class Parser {
public:
boost::shared_ptr<Graph>
parse ( std::string filename,
std::string directory )
{
// Line 110 Formula_Parser.cpp
m_graph.reset ( new Graph() );
... parse file ...
return m_graph;
}
void endElement ( ... )
{
// Add item to m_graph
m_graph.add ( new Component );
}
private
boost::shared_ptr<Graph> m_graph;
};
==28769== Uninitialised byte(s) found during client check request
==28769== at 0x4161127: libreverse::api::Reverse_Impl::print_Graph(libreverse::infrastructure::Component_Graph const&, std::string) const (Reverse_Impl.cpp:183)
==28769== by 0x4161D96: libreverse::api::Reverse_Impl::execute_Input_Section(boost::shared_ptr
participants (1)
-
Stephen Torri