Connecting Tech Pros Worldwide Help | Site Map

memory leak problem

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 23rd, 2007, 04:15 PM
antani
Guest
 
Posts: n/a
Default 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?


  #2  
Old March 23rd, 2007, 04:35 PM
=?ISO-8859-1?Q?Erik_Wikstr=F6m?=
Guest
 
Posts: n/a
Default Re: memory leak problem

On 2007-03-23 17:14, antani wrote:
Quote:
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
  #3  
Old March 23rd, 2007, 04:55 PM
red floyd
Guest
 
Posts: n/a
Default Re: memory leak problem

antani wrote:
Quote:
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.


  #4  
Old March 23rd, 2007, 05:05 PM
Salt_Peter
Guest
 
Posts: n/a
Default Re: memory leak problem

On Mar 23, 12:14 pm, "antani" <antani8...@yahoo.itwrote:
Quote:
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.


  #5  
Old March 24th, 2007, 04:25 PM
Giff
Guest
 
Posts: n/a
Default Re: memory leak problem

red floyd ha scritto:

If you're using Task Manager,
Quote:
it's notoriously wrong.
I did not know that, can you give some references on why and how it is
wrong?
  #6  
Old March 24th, 2007, 08:25 PM
Jim Langston
Guest
 
Posts: n/a
Default Re: memory leak problem

"Giff" <giffnews@gmail.com.invalidwrote in message
news:eu3j3b$mdq$2@aioe.org...
Quote:
red floyd ha scritto:
>
If you're using Task Manager,
Quote:
>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.


  #7  
Old March 27th, 2007, 05:55 PM
Giff
Guest
 
Posts: n/a
Default Re: memory leak problem

Jim Langston ha scritto:


It's just inaccurate.

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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.