473,834 Members | 1,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

memory leakage

i want to know that on what situation memory leakage happan and what
is the solution to solve the problem of memory leakage.

Feb 21 '07 #1
14 2349
On Feb 20, 7:30 pm, "madhawi" <madhaw...@gmai l.comwrote:
i want to know that on what situation memory leakage happan
When you have more calls to malloc() and calloc() than you do to
free().
and what
is the solution to solve the problem of memory leakage.
Have one call to free() for each call to calloc() or malloc() that
your program makes.

If you want to fix something that's broken, look here:
https://buildsecurityin.us-cert.gov/...oding/311.html
Feb 21 '07 #2
i m working on a large project. and i used free() for memory. but
still i get problem. when i removed the line from where i m getting
memory leakage, then i get another problem, loss of information.
user923005 wrote:
On Feb 20, 7:30 pm, "madhawi" <madhaw...@gmai l.comwrote:
i want to know that on what situation memory leakage happan

When you have more calls to malloc() and calloc() than you do to
free().
and what
is the solution to solve the problem of memory leakage.

Have one call to free() for each call to calloc() or malloc() that
your program makes.

If you want to fix something that's broken, look here:
https://buildsecurityin.us-cert.gov/...oding/311.html
Feb 21 '07 #3
On Feb 21, 8:30 am, "madhawi" <madhaw...@gmai l.comwrote:
i want to know that on what situation memory leakage happan and what
<forwarded to comp.programmin g>

you allocate some memory,
you use those memory,
now you dont want the memory --you have done(and you should free the
memory)

you forgot to free the memory and go ahead, and now you cant come back
to free the memory.

i think this is called leak (I may need to more correct but this is
what basics come to my mind,)

http://en.wikipedia.org/wiki/Memory_leak
http://www.valgrind.org/docs/manual/...-start.prepare

is the solution to solve the problem of memory leakage.
yes, it is solvable,
1. Good Programming habits,
2. Good Toolset (for linux valgrind/memprof is reasonably good,)

--Raxit

Feb 21 '07 #4
i am using c++. i used delete and destructor to free the memory. can u
help me this in c++, please.
raxitsheth2...@ yahoo.co.in wrote:
On Feb 21, 8:30 am, "madhawi" <madhaw...@gmai l.comwrote:
i want to know that on what situation memory leakage happan and what

<forwarded to comp.programmin g>

you allocate some memory,
you use those memory,
now you dont want the memory --you have done(and you should free the
memory)

you forgot to free the memory and go ahead, and now you cant come back
to free the memory.

i think this is called leak (I may need to more correct but this is
what basics come to my mind,)

http://en.wikipedia.org/wiki/Memory_leak
http://www.valgrind.org/docs/manual/...-start.prepare

is the solution to solve the problem of memory leakage.

yes, it is solvable,
1. Good Programming habits,
2. Good Toolset (for linux valgrind/memprof is reasonably good,)

--Raxit
Feb 21 '07 #5
madhawi wrote:

Please don't top-post.
user923005 wrote:
>>On Feb 20, 7:30 pm, "madhawi" <madhaw...@gmai l.comwrote:
>>>i want to know that on what situation memory leakage happan

When you have more calls to malloc() and calloc() than you do to
free().
>>>and what
is the solution to solve the problem of memory leakage.

Have one call to free() for each call to calloc() or malloc() that
your program makes.

If you want to fix something that's broken, look here:
https://buildsecurityin.us-cert.gov/...oding/311.html

i m working on a large project. and i used free() for memory. but
still i get problem. when i removed the line from where i m getting
memory leakage, then i get another problem, loss of information.
Please capitalise your sentences and 'I'.

Assuming your debugger supports is it, run the program with leak
checking enabled. If it doesn't, ask on a platform specific group about
tools to do this for you.

If you build your application in small, tested, steps checking for leaks
as you go, you stand a better chance of avoiding these problems.

--
Ian Collins.
Feb 21 '07 #6
madhawi wrote:
i am using c++. i used delete and destructor to free the memory. can u
help me this in c++, please.
u doesn't post here any more.

Sounds like you should either be asking on a C++ or Linux programming group.

--
Ian Collins.
Feb 21 '07 #7
"madhawi" <ma*******@gmai l.comwrites:
i want to know that on what situation memory leakage happan
Memory is allocated but not deallocated.
and what
is the solution to solve the problem of memory leakage.
Deallocate any memory that you allocate.

Memory is allocated by calling malloc() and deallocated by calling
free(). Each chunk of memory allocated by malloc() should be released
by calling free() when you're done with it.

Of course it's not necessarily that simple, but explaining the details
would be equivalent to explaining how to program.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 21 '07 #8
I am asking in C++. I use my application on Window2000.
Ian Collins wrote:
madhawi wrote:
i am using c++. i used delete and destructor to free the memory. can u
help me this in c++, please.

u doesn't post here any more.

Sounds like you should either be asking on a C++ or Linux programming group.

--
Ian Collins.
Feb 21 '07 #9
madhawi wrote:
I am asking in C++. I use my application on Window2000.
When you do, don't forget not to top post!
Ian Collins wrote:
>>madhawi wrote:
>>>i am using c++. i used delete and destructor to free the memory. can u
help me this in c++, please.

u doesn't post here any more.

Sounds like you should either be asking on a C++ or Linux programming group.

--
Ian Collins.
Feb 21 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3737
by: frustrated | last post by:
Before I begin, I must first make the following disclaimer: Although I have considerable programming experience, I do not consider myself by any means to be an expert C++ programmer. The following may be nothing more than a relection of my ignorance. If what I describe is not an actual bug, I would be very appreciative if you could briefly explain to me how I can de-allocate memory allocated by a set class, since everything I have tried is...
0
1814
by: boy | last post by:
Hi all, I have created a simple template class as follow, but i encountered memory leakage on the base.Render(writer). Have all you of encountered the same problem? using System; using System.Web.UI; public class PageBase : System.Web.UI.Page {
7
1779
by: andylcx | last post by:
hi all: I have a code like below, is there any serious memory leakage in my code. I am confusion now but no idea how to fix it. In the member function of class A, I create a new object of class B like below: void A::function() { B *newobject = new B; newobject->....; newobject->....; //did some action here
18
2278
by: Ramasubbu Ramasubramanian XR (AS/EAB) | last post by:
What is memory leakage, could any one explain with sample code
1
3806
by: GaŽl | last post by:
Hi everybody! I have a really big problem with ASP.NET application. I noticed that the w3wp.exe memory size, increase with the time and the use of my website. When it raise a certain value, w3wp crashes and restart just after. My application is on a WebServer2003. So I have to resolve 2 problem : -Why the memory size of the w3wp increase non stop. - Why the w3wp crashes (in the case where there is no link between those
2
1399
by: chets | last post by:
Hi all Can anyone tell me what is the difference between:- *p=q; and p=&q; in C where declaration is like this char **p; char *q; Because if I do *p=q; in one file after mallocing q and want to free q
0
1373
by: kiran kumar | last post by:
Hi All, I am working on embedded python on C these days. I feel there is a memory leakage in this code. I have used our own memory pool and all the python code will use the heap from this memory pool. RunScript(pScriptName,pFuncName,...) { PyEval_AcquireLock() threadState = Py_NewInterpreter(); PyThreadState_Swap(threadState);
7
415
by: madhawi | last post by:
please give me the solution for the problem of memory leakage.
11
2312
by: prpradip | last post by:
I have an ImageList (_imageList). In _imageList I have put large numbers of Icons. Now what I need is to get Handle of all Icons that I put in _imageList, so that I can destroy (DestoryIcon) them all and release the memory because it's causing Memory leakage.
0
9643
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10790
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10505
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10214
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6952
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5790
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3079
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.