469,917 Members | 1,695 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,917 developers. It's quick & easy.

memory leak problem

Every time that I call a function, time for execution and memory
allocation program increase.
I use stl vector, and 5 array c++ style and I remove them in
destructor.
Can you suggest me a solution for debugging memory leak?

Mar 23 '07 #1
6 1955
On 2007-03-23 17:14, antani wrote:
Every time that I call a function, time for execution and memory
allocation program increase.
I use stl vector, and 5 array c++ style and I remove them in
destructor.
Can you suggest me a solution for debugging memory leak?
Sure, start by posting a *minimal* example exhibiting the problem,
unless you show us some code we can't even begin to guess what you've
been doing.

--
Erik Wikström
Mar 23 '07 #2
antani wrote:
Every time that I call a function, time for execution and memory
allocation program increase.
I use stl vector, and 5 array c++ style and I remove them in
destructor.
Can you suggest me a solution for debugging memory leak?
Why do you think you have a memory leak? If you're using Task Manager,
it's notoriously wrong. Secondly, often a program's memory size will
increase with no leak, because while dynamically allocated memory is
returned to the free store, that memory is still allocated to the
process and not returned to the OS.

So:

int main()
{
char *bigalloc = new char[10000000];
delete[] bigalloc;

while (true)
/* do nothing */ ;
}

will often show a size of 10000000 in the loop, even though there is no
memory leak.

Such issues are implementation dependent.
Mar 23 '07 #3
On Mar 23, 12:14 pm, "antani" <antani8...@yahoo.itwrote:
Every time that I call a function, time for execution and memory
allocation program increase.
I use stl vector, and 5 array c++ style and I remove them in
destructor.
Can you suggest me a solution for debugging memory leak?
No suggestion is possible, you've not shown the problem.
Mar 23 '07 #4
red floyd ha scritto:

If you're using Task Manager,
it's notoriously wrong.
I did not know that, can you give some references on why and how it is
wrong?
Mar 24 '07 #5
"Giff" <gi******@gmail.com.invalidwrote in message
news:eu**********@aioe.org...
red floyd ha scritto:

If you're using Task Manager,
>it's notoriously wrong.

I did not know that, can you give some references on why and how it is
wrong?
Run a program for a while. Anything that uses memory. Go into task manager
and look at memory used. Minimize the app. Bring it back up. WTF? The
memory usage changed? It's just inaccurate.
Mar 24 '07 #6
Jim Langston ha scritto:
It's just inaccurate.

ok but it's just a few KBytes, in my case it's acceptable

Mar 27 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Debian User | last post: by
4 posts views Thread by Morten Aune Lyrstad | last post: by
17 posts views Thread by José Joye | last post: by
13 posts views Thread by Boni | last post: by
23 posts views Thread by James | last post: by
7 posts views Thread by Salvador | last post: by
18 posts views Thread by diffuser78 | last post: by
3 posts views Thread by Jim Land | last post: by
9 posts views Thread by jeungster | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.