Heap memory has a lifetime that begins when the memory is allocated. Once allocated, that memory exists until the free()function is called to release that memory. Allocating and releasing memory is also called memory management within a program.
Alternatively, all memory is deallocated when the program exits, both in terms of fixed memory and dynamic memory. It is generally considered a sloppy practice to ignore memory management for dynamic memory, especially for large, complex programs or for programs that are likely to run for a very long time.