Ray Tayek on Thu, 19 Jan 2006 13:48:43 -0600 (CST) |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: [ALACPP] memory leak |
At 08:13 AM 1/19/2006, you wrote:
24 bytes would be the size of the _Node type for the std::map<MapSite::Direction,MapSite *> you're using (this would be the the same size for nodes of all maps using the std traits, regardless of value_type, I believe). A new node is created everytime you invoke insert.
that sortamakes sense.
In the VS2003 implementation, the _Node type contains the following fields (each 4 bytes in size):_Left _Parent _Right _Myval _Color _IsnilWhat you're seeing isn't a memory leak. The map itself will deallocate the nodes at destruction time.
it does not seem to do that. thanks
Ray Tayek <rtayek@xxxxxxxxxxx> wrote: sorry about the large post, used to java At 05:39 PM 1/18/2006, you wrote: > > At 11:21 PM 1/17/2006, you wrote: > > >hi, trying to code up some stuff for a class ... > > > > it's worse than i thought. the code below seems to also have the leak: > > MapSite *Room::setSide(MapSite::Direction direction,MapSite *mapSite) { > > MapSite *rc=NULL; > > pair::iterator,bool> > > p=sides_.insert(map > > *>::value_type(direction,mapSite)); > > if(!p.second) > > { rc=p.first->second; p.first->second=mapSite; } > > } > > ...
--- vice-chair http://ocjug.org/ _______________________________________________ alacpp mailing list alacpp@xxxxxxxxxxx http://lists.ellipsis.cx/mailman/listinfo/alacpp