Hewlett Packard Interview Question for Consultants


Country: India
Interview Type: In-Person




Comment hidden because of low score. Click to expand.
4
of 4 vote

When Dynamically allocated memory is not freed after its use, it leads to memory leak.
It is a very sensitive issue in embedded programming

- Avi June 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

when dynamic allocated memory is not freed after its use. This result in the memory leak.

- Punit Jain May 12, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

A memory leak refers to the memory which cannot be accessed. More simply, The pointer which was pointing to the memory has been destroyed.

- Guddu Sharma May 12, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think this question can be extended into how to avoid memory leak

- AMG May 12, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Char *ptr1= malloc(sizeof(5));

Char *ptr2= malloc(sizeof(6));

ptr1=ptr2;
free (ptr1); /* now it frees the ptr2 allocation */
here the 5 allocated is memory leak which can be freed as we dont have the pointer of that memory location.

- vijaymukilan July 10, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Char *ptr1= malloc(sizeof(5));

Char *ptr2= malloc(sizeof(6));

ptr1=ptr2;
free (ptr1); /* now it frees the ptr2 allocation */
here the 5 allocated is memory leak which canNOT be freed as we dont have the pointer of that memory location.

- Krishna Dani October 06, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

When dynamically allocated memory is not freed and the pointer which was pointing to that memory space goes out of the program scope or is re pointed to null than that chunk of memory is said to be leaked

- saurav May 02, 2015 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More