Jon Stewart on Wed, 18 Jan 2006 19:39:20 -0600 (CST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [ALACPP] memory leak


> 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<map<MapSite::Direction,MapSite *>::iterator,bool> 
> p=sides_.insert(map<MapSite::Direction,MapSite 
> *>::value_type(direction,mapSite));
>          if(!p.second)
>                  { rc=p.first->second; p.first->second=mapSite; }
> }
> 
> 
> anybody got a clue


Hi Ray! Some questions:

1. What are you using for a leak detection tool?

2. Can you post the code to the whole class?

3. Why the raw pointers?

4. When you put a MapSite into the list, is the map supposed to be the 
sole owner of that object now? When the map is destroyed, or when the item 
is removed, is it supposed to be destroyed?

thanks,


Jon
-- 
Jon Stewart
stew1@xxxxxxxxxxx
_______________________________________________
alacpp mailing list
alacpp@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/alacpp