what is memory leak?
Answers were Sorted based on User's Feedback
Answer / roshan.p.r.
Consider the following example..
int *p=new int[10];
here ten bytes of memory is allocated and the address is
stored in p. the only way to access this memory is via p.
now suppose if u allocate a new memory to p like
p=new int[20];
the previous address(10 bytes is lost we cant access it
again)because the only way that we had to access it was
pointer p and now a new address(20 bytes) is stored in p.
So we say there is a memory leak.
the best way to handle this is.
int *p=new int[10];
[]delete p;
p=0;
p=new int[20];
so in the above case we have first released the memory
pointed by p with delete function and then a new address is
assigned to it.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sujith
Memory leak is nothing but u create huge chunk of memory
with a malloc or any such mechanism and u never free that
manually which make the available free main memory in the
system to minimum. this may even lead to system crashing.
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / tayyab
When two object create a reference to each other. memory
allocated to these objects can not be reclaimed by
operating system even after when all other references are
deleted for these objects.....this concept is called memory
leak
Is This Answer Correct ? | 0 Yes | 1 No |
What is variable declaration and definition in c?
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
how would a 4*3 array A[4][3] stored in Row Major Order?
Write a program in c using only loops to print * * * * * *******
What is action and transformation in spark?
In which header file is the null macro defined?
What is the use of ?: Operator?
What is operator precedence?
struct node {struct node*temp,*new} prinf("%d",sizeof(struct node));
what is the mean of c languages.
WAP TO ACCEPT STRING AND COUNT A COMES N TIMES B COMES N TIMES C COMES N TIMES D COMES N TIMES AND SO ON......... AT LAST UNTIL Z COMES N TIMES...............
#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2 = 5; printf ( "\n The sum is :%d", value1 | value2 ); } This is the answer asked by some one to add two numbers with out using arithmetic operator?Yes this answer is write it given out put as 15.But how????? what is need of following line? int main ( int argc, char* argv [ ] ) how it work?what is the meaning for this line? please explain me.Advance thanks