Solved

Regarding Memory!

Posted on 2000-04-16
2
171 Views
Last Modified: 2010-04-02
What is memory leak & memory overwrite?(in C or c++)
0
Comment
Question by:vinusa500
2 Comments
 
LVL 1

Accepted Solution

by:
Toad224 earned 25 total points
ID: 2784880
A memory leak is a memory leak in general.  It is not specific toward a certain programming language (as you have stated 'in C'.)

A memory leak is when you load something, and do not close it.  For example (using the Windows API):

HANDLE A = LoadIcon(...);

This will Load the icon into 'A'.  However, this consumes memory.  If you do not call 'CloseHandle' after you have finished using 'A', the memory will not be available for other things, and will still hold the icon information.  Let's say you had a timer, which constantly loaded something without closing it.  It would constantly take up memory.  This is what we call a 'memory leak'.  Eventually, there will be no memory left, and could cause General Protection Faults (Windows) or Kernel Panics (Linux).

A memory overwrite is when you have a variable such as:

LPSTR A[25];

The definition is exactly what it sounds like.  If you accidentally had written over a part of that memory.
0
 
LVL 1

Expert Comment

by:Vinay
ID: 2788329
i like this answer but will u plz more clerify it in proper C examples using array or pointer notations.
Thanks
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now