Solved

Regarding Memory!

Posted on 2000-04-16
2
176 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

734 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