Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Noncompliant Code Example

This noncompliant code example shows a leaking Vector object. The memory leak quickly exhausts the heap space as the condition for removing the vector element is mistakenly written as n > 0 instead of n >= 0. As a result, in every iteration, the method leaks one vector element.

...