Search code examples
c++memory-leaksterminologyspace-leak

Space leak in C++?


In Google's C++ test framework, my eyes read:

.. returns from the current function immediately, possibly skipping clean-up code that comes after it, it may cause a space leak.

while my brain expected to see a memory leak.

Is that terminology used in C++? If so, what does it mean (in other words how it's distinguishable from a memory leak)?


In Haskell, a space leak refers to a situation where a program or specific computation uses much more memory than is necessary.

In Java, using the phrase "space leak" doesn't make sense.


Solution

  • Space leak does not seem specific to a particular language. Wikipedia has this to say about space leak:

    A space leak occurs when a computer program uses more memory than necessary. In contrast to memory leaks, where the leaked memory is never released, the memory consumed by a space leak is released, but later than expected.

    This is same as what it means in Haskell as per your cite.