Y
yogpjosh
Hello All,
I was asked a question in an interview..
Its related to dynamically allocated and deallocated memory.
eg.
//start
char * p = new char[1000];
...
....
delete [] p;
//end
The quesiton was..How will I be sure the deallocated memory is returned
to heap?
I answered make p = NULL.But again the interviewer was probably
expecting different answer as the debate went on thereafter...
So for me my knoweldge about dynamically allocated and deallocated
memroy starts with new and ends with delete...
So is there any such thing like making sure that the deallocated(or
freeed) memory is returned to the heap?
Thanks and Regards,
Yogesh
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
I was asked a question in an interview..
Its related to dynamically allocated and deallocated memory.
eg.
//start
char * p = new char[1000];
...
....
delete [] p;
//end
The quesiton was..How will I be sure the deallocated memory is returned
to heap?
I answered make p = NULL.But again the interviewer was probably
expecting different answer as the debate went on thereafter...
So for me my knoweldge about dynamically allocated and deallocated
memroy starts with new and ends with delete...
So is there any such thing like making sure that the deallocated(or
freeed) memory is returned to the heap?
Thanks and Regards,
Yogesh
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]