Re: do you ever found memory leak with STL?
From: Gernot Frisch (Me_at_Privacy.net)
Date: 07/26/04
- Next message: Victor Bazarov: "Re: STL sort problem"
- Previous message: John Harrison: "Re: STL sort problem"
- In reply to: rokia: "do you ever found memory leak with STL?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 26 Jul 2004 15:49:00 +0200
"rokia" <rokiadd@yahoo.com.cn.discuss> schrieb im Newsbeitrag
news:ce29mq$1f2m$1@mail.cn99.com...
>
> I found many people encounter this problem.
>
> and someone say that it's STL strategy.
>
> but I dont know when will it release those memory.
>
> BoundCheck report there are many memory leak when I use vector to
push_back
> thousands class.
>
> any advice?
Yes. Sure. You're using a pointer to an element inside the vector. Now
you push/pop/remove any element and whoppa - the pointer does not
point to an element anymore, since the STL container re-allocated the
objects. Now you use any member of that object and see funny errors...
Just a thought... Post code if you're not sure.
-Gernot
- Next message: Victor Bazarov: "Re: STL sort problem"
- Previous message: John Harrison: "Re: STL sort problem"
- In reply to: rokia: "do you ever found memory leak with STL?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|