Boost logo

Boost Users :

From: Stephen Torri (storri_at_[hidden])
Date: 2007-04-03 21:12:05


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.

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;
        }

private
        boost::shared_ptr<Graph> m_graph;
};

The error I am getting is saying that the problem appears to be in the

==28769== by 0x4154024: libreverse::api::Reverse::execute(std::string const&, unsigned const&, unsigned const&) (Reverse.cpp:128)
==28769== by 0x8055869: main (reverse.cpp:50)
==28769== Address 0x4389BC0 is 8 bytes inside a block of size 60 alloc'd
==28769== at 0x4005BA5: operator new(unsigned) (vg_replace_malloc.c:163)
==28769== by 0x41968E1: libreverse::infrastructure::Formula_Parser::get_Graph(std::string, std::string) (Formula_Parser.cpp:110)
==28769== by 0x419351E: libreverse::infrastructure::Configurator::get_Graph(unsigned, unsigned) (Configurator.cpp:110)
==28769== by 0x4153FBC: libreverse::api::Reverse::execute(std::string const&, unsigned const&, unsigned const&) (Reverse.cpp:115)
==28769== by 0x8055869: main (reverse.cpp:50)
==28769==
==28769== Uninitialised byte(s) found during client check request
==28769== at 0x4161176: libreverse::api::Reverse_Impl::print_Graph(libreverse::infrastructure::Component_Graph const&, std::string) const (Reverse_Impl.cpp:184)
==28769== by 0x4161D96: libreverse::api::Reverse_Impl::execute_Input_Section(boost::shared_ptr<std::map<std::string, boost::shared_ptr<libreverse::infrastructure::Component_Graph>, std::less<std::string>, std::allocator<std::pair<std::string const, boost::shared_ptr<libreverse::infrastructure::Component_Graph> > > > > const&, boost::shared_ptr<libreverse::infrastructure::Data_Source_Base const>, boost::shared_ptr<libreverse::infrastructure::Component>) (Reverse_Impl.cpp:45)
==28769== by 0x4154024: libreverse::api::Reverse::execute(std::string const&, unsigned const&, unsigned const&) (Reverse.cpp:128)
==28769== by 0x8055869: main (reverse.cpp:50)
==28769== Address 0xBE9D82CC is on thread 1's stack
Visiting node: 1


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