Space leak

A data structure which grows bigger, or lives longer, than might be expected. Such unexpected memory use can cause a program to require more garbage collections or to run out of heap. Space leaks in functional programs usually result from excessive laziness. For example, the Haskell function
sum [] = 0 sum (x:xs) = x + sum xs
when applied to a list will build a chain of closures for the additions and only when it reaches the end of the list will it perform the additions and free the storage. Another example is the function
mean l = sum l / length l
The sum function forces the entire list l to be evaluated and built in the heap. None of it can be garbage collected until the length function has consumed it.


Read Also:

  • Spaceless

    adjective 1. having no limits or dimensions in space; limitless; unbounded. 2. occupying no space. adjective (mainly literary) 1. having no limits in space; infinite or boundless 2. occupying no space

  • Spaceman

    noun, plural spacemen [speys-men, -muh n] /ˈspeɪsˌmɛn, -mən/ (Show IPA) 1. an astronaut. 2. a visitor to earth from outer space; extraterrestrial. noun (pl) -men, -women 1. a person who travels in outer space, esp one trained to participate in a space flight

  • Space-man

    noun 1. space writer.

  • Space-mark

    noun, Printing. 1. a proofreader’s symbol used to indicate the need to insert space, as between two typed or printed words that have been run together. Symbol: #.

Disclaimer: Space leak definition / meaning should not be considered complete, up to date, and is not intended to be used in place of a visit, consultation, or advice of a legal, medical, or any other professional. All content on this website is for informational purposes only.