SPACE LEAK
\spˈe͡ɪs lˈiːk], \spˈeɪs lˈiːk], \s_p_ˈeɪ_s l_ˈiː_k]\
Sort: Oldest first
-
A data structure which grows bigger, or lives longer, thanmight be expected. Such unexpected memory use can cause aprogram to require more garbage collections or to run out ofheap. Space leaks in functional programs usually resultfrom excessive laziness. For example, the Haskell functionsum [] = 0sum (x:xs) = x + sum xswhen applied to a list will build a chain of closures for theadditions and only when it reaches the end of the list will itperform the additions and free the storage. Another exampleis the functionmean l = sum l / length lThe sum function forces the entire list l to be evaluated andbuilt in the heap. None of it can be garbage collected untilthe length function has consumed it.
By Denis Howe
Word of the day
hydromorphic
- [Greek] Structurally adapted to an aquatic environment, as organs of water plants.