Q:

What is the memory leak in C?

0

What is the memory leak in C?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

A memory leak is a common and dangerous problem. It is a type of resource leak. In C language, a memory leak occurs when you allocate a block of memory using the memory management function and forget to release it.

int main ()
{
    char * pBuffer = malloc(sizeof(char) * 20);
    /* Do some work */
    return 0; /*Not freeing the allocated memory*/
}

Note: once you allocate a memory than allocated memory does not allocate to another program or process until it gets free.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Embedded C interview questions and answers (2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What is the output of the below C code?... >>
<< What is static memory allocation and dynamic memor...