[prev] 29 [next]

Memory Leaks

Well-behaved programs do the following:
  • allocate a new object via malloc()
  • use the object for as long as needed
  • free() the object when no longer needed
A program which does not free() each object before the last reference to it is lost contains a memory leak.

Such programs may eventually exhaust available heapspace.