What exactly does it mean, besides the obvious? What exactly causes a Memory Leak?
An ill-maintained memory faucet?
it makes perfect sense now, any serious answers?
Something that keeps eating away at the end-user's ram. Just blocks of memory sitting there used up, with no purpose. Like loading data from a file and having the thing jsut sit in momory (prime example, during bnet's hashing functions, you have to load the files DWORDS at a time, they add up.)
~-~(HDX)~-~
Memory that is allocated that isn't deallocated. For example in C/C++ allocating data using malloc/new and forgetting to free/delete[] it. The memory is still marked as used by the system's memory manager, so it can't be used to fill another memory allocation request.
A Memory Leak can be described in many ways.
A. It could be any block of memory that remains allocated when the program finishes execution and has to be automatically freed by the OS.
B. It could be any allocated memory block to which there is no reference or pointer in the program.
C. It could be a program doing something, and after it's done that has a higher memory use than before.
D. It could be C, with the additional requirement that the memory use continues to grow without an upper bound as the program executes.
For A:
main()
{
char *a = new char[100];
}
For B:
main()
{
char *a = new char[100];
a = 0;
}
For C:
func(int n)
{
static int *ar[100];
if(!ar[n]) ar[n] = new int;
}
main()
{
func(1);
func(2);
}
For D:
func(int n)
{
struct item {
int n;
struct item *next;
};
static item *head;
item *p;
p = new item;
p->n = n;
p->next = head;
head = p;
}
main()
{
func(1);
func(2);
}
good thing Kp explained so well that I don't have to figure out what the rest of you guys are saying with your crazy big words like allocated memory block.
Quote from: 111787 on May 19, 2005, 02:03 PM
good thing Kp explained so well that I don't have to figure out what the rest of you guys are saying with your crazy big words like allocated memory block.
If you don't understand the idea of an allocated memory block, you really have no business managing memory. If you aren't managing memory, you can't affect any potential leaks, which makes explaining them to you pointless.
Quote from: Kp on May 19, 2005, 04:29 PM
Quote from: 111787 on May 19, 2005, 02:03 PM
good thing Kp explained so well that I don't have to figure out what the rest of you guys are saying with your crazy big words like allocated memory block.
If you don't understand the idea of an allocated memory block, you really have no business managing memory. If you aren't managing memory, you can't affect any potential leaks, which makes explaining them to you pointless.
You are not a very good detector of sarcasm. :P
Quote from: Maddox on May 19, 2005, 05:03 PMYou are not a very good detector of sarcasm. :P
Based on the original poster's comments, it seemed unlikely he had the presence of mind to be sarcastic, so I took him seriously.
Quote from: Kp on May 19, 2005, 05:57 PM
Quote from: Maddox on May 19, 2005, 05:03 PMYou are not a very good detector of sarcasm. :P
Based on the original poster's comments, it seemed unlikely he had the presence of mind to be sarcastic, so I took him seriously.
I think you need to get out more.
Quote from: Maddox on May 19, 2005, 10:09 PM
Quote from: Kp on May 19, 2005, 05:57 PM
Quote from: Maddox on May 19, 2005, 05:03 PMYou are not a very good detector of sarcasm. :P
Based on the original poster's comments, it seemed unlikely he had the presence of mind to be sarcastic, so I took him seriously.
I think you need to get out more.
I think Kp's response was perfectly understandable. *shrug*
A memory leak is what happens when you open a drawer, but forget to close it.
..rofl
Quote from: MyndFyre on May 19, 2005, 10:40 PM
Quote from: Maddox on May 19, 2005, 10:09 PM
Quote from: Kp on May 19, 2005, 05:57 PM
Quote from: Maddox on May 19, 2005, 05:03 PMYou are not a very good detector of sarcasm. :P
Based on the original poster's comments, it seemed unlikely he had the presence of mind to be sarcastic, so I took him seriously.
I think you need to get out more.
I think Kp's response was perfectly understandable. *shrug*
Yeah, if you live under a rock.
I live under a rock, can I have a cookie?