Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Regarding Memory!

Posted on 2000-04-16
2
Medium Priority
?
183 Views
Last Modified: 2010-04-02
What is memory leak & memory overwrite?(in C or c++)
0
Comment
Question by:vinusa500
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
Toad224 earned 50 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…
Suggested Courses

610 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