Hi all,

I have a class that looks like:

typedef map<Node*,Node*> NodeMap;

class Component
{
NodeMap inputMap;
NodeMap outputMap;
Node* node;

public:
Component();

~Component()
};

In the destructor I delete node and the rest is done by the compiler. The
funny part is that ~Component() fails with the following stack :

------------------------------------------------------------------------
std::_Tree<std::_Tmap_traits<Node *,Node *,std::less<Node
*>,std::allocator<std::pair<Node * const,Node *> >,0> >::begin() C++
------------------------------------------------------------------------
std::_Tree<std::_Tmap_traits<Node *,Node *,std::less<Node
*>,std::allocator<std::pair<Node * const,Node *> >,0> >::_Tidy() C++
------------------------------------------------------------------------
std::_Tree<std::_Tmap_traits<Node *,Node *,std::less<Node
*>,std::allocator<std::pair<Node * const,Node *> >,0>
>::~_Tree<std::_Tmap_traits<Node *,Node *,std::less<Node
*>,std::allocator<std::pair<Node * const,Node *> >,0> >() C++
------------------------------------------------------------------------
std::map<Node *,Node *,std::less<Node *>,std::allocator<std::pair<Node *
const,Node *> > >::~map<Node *,Node *,std::less<Node
*>,std::allocator<std::pair<Node * const,Node *> > >() C++
------------------------------------------------------------------------
Component::~Component() C++
------------------------------------------------------------------------


and I don't really understand why. All that I do with inputMap and outputMap
are some inserts. However if I switch to STLport I don't see the problem.

Any ideas? I'm thinking memory corruption but not sure....

Nick

Re: map fails in destructor by Nick

Nick
Wed Nov 19 17:20:48 CST 2003

Doh! It was memory corruption! :)

Nick

"Nick Savoiu" <savoiu@ics_.uci_.edu_> wrote in message
news:eEMi5CvrDHA.2224@TK2MSFTNGP09.phx.gbl...
> Hi all,
>
> I have a class that looks like:
>
> typedef map<Node*,Node*> NodeMap;
>
> class Component
> {
> NodeMap inputMap;
> NodeMap outputMap;
> Node* node;
>
> public:
> Component();
>
> ~Component()
> };
>
> In the destructor I delete node and the rest is done by the compiler. The
> funny part is that ~Component() fails with the following stack :
>
> ------------------------------------------------------------------------
> std::_Tree<std::_Tmap_traits<Node *,Node *,std::less<Node
> *>,std::allocator<std::pair<Node * const,Node *> >,0> >::begin() C++
> ------------------------------------------------------------------------
> std::_Tree<std::_Tmap_traits<Node *,Node *,std::less<Node
> *>,std::allocator<std::pair<Node * const,Node *> >,0> >::_Tidy() C++
> ------------------------------------------------------------------------
> std::_Tree<std::_Tmap_traits<Node *,Node *,std::less<Node
> *>,std::allocator<std::pair<Node * const,Node *> >,0>
> >::~_Tree<std::_Tmap_traits<Node *,Node *,std::less<Node
> *>,std::allocator<std::pair<Node * const,Node *> >,0> >() C++
> ------------------------------------------------------------------------
> std::map<Node *,Node *,std::less<Node *>,std::allocator<std::pair<Node *
> const,Node *> > >::~map<Node *,Node *,std::less<Node
> *>,std::allocator<std::pair<Node * const,Node *> > >() C++
> ------------------------------------------------------------------------
> Component::~Component() C++
> ------------------------------------------------------------------------
>
>
> and I don't really understand why. All that I do with inputMap and
outputMap
> are some inserts. However if I switch to STLport I don't see the problem.
>
> Any ideas? I'm thinking memory corruption but not sure....
>
> Nick
>
>