memory leak problem

A

antani

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?
 
?

=?ISO-8859-1?Q?Erik_Wikstr=F6m?=

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.
 
R

red floyd

antani said:
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.
 
S

Salt_Peter

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.
 
J

Jim Langston

Giff said:
red floyd ha scritto:

If you're using Task Manager,

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.
 
G

Giff

Jim Langston ha scritto:


It's just inaccurate.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top