473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 2236
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Debian User | last post by:
Hi, I'm trying to discover a memory leak on a program of mine. I've taken several approaches, but the leak still resists to appear. First of all, I've tried to use the garbage collector to...
3
by: Jeremy Lemaire | last post by:
Hello, I am working on cross platform code that is displaying a huge memory leak when compiled on 11.00 HPUX using the aCC -AA flag. It is not leaking on NT, LINUX, Solaris, or HPUX without the...
4
by: Morten Aune Lyrstad | last post by:
Ok, now I'm officially confused. I have a large project going, which uses a win32 ui library I am developing myself. And I'm getting weird memory leaks. I don't know if I can explain what is going...
17
by: José Joye | last post by:
Hi, I have implemented a Service that is responsible for getting messages from a MS MQ located on a remote machine. I'm getting memory leak from time to time (???). In some situation, it is...
13
by: Boni | last post by:
I use 3-d party component. In this component I must pass a reference to my object. The problem is that this component has an ugly bug.When this component is disposed, it incorrectly don't delete...
23
by: James | last post by:
The following code will create memory leaks!!! using System; using System.Diagnostics; using System.Data; using System.Data.SqlClient; namespace MemoryLeak
7
by: Salvador | last post by:
Hi, I am using WMI to gather information about different computers (using win2K and win 2K3), checking common classes and also WMI load balance. My application runs every 1 minute and reports...
18
by: diffuser78 | last post by:
I have a python code which is running on a huge data set. After starting the program the computer becomes unstable and gets very diffucult to even open konsole to kill that process. What I am...
3
by: Jim Land | last post by:
Jack Slocum claims here http://www.jackslocum.com/yui/2006/10/02/3-easy-steps-to-avoid-javascript- memory-leaks/ that "almost every site you visit that uses JavaScript is leaking memory". ...
9
by: jeungster | last post by:
Hello, I'm trying to track down a memory issue with a C++ application that I'm working on: In a nutshell, the resident memory usage of my program continues to grow as the program runs. It...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.