Solved

Regarding Memory!

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
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.

911 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

21 Experts available now in Live!

Get 1:1 Help Now