It is always recommended to free the dynamically allocated memory. If we forgot to free the dynamically allocated memory, It will cause a memory leak. When the program stops all the dynamically allocated memory will be released, But if you are program is a long-running process like an operating system, web server, or any application server, Then we can observe the memory leak (slow growth of memory usage). So we should always free the dynamically allocated memory to avoid the memory leak.