{"id":6120,"date":"2014-05-28T00:01:44","date_gmt":"2014-05-28T07:01:44","guid":{"rendered":"http:\/\/www.wambooli.com\/blog\/?p=6120"},"modified":"2014-05-24T13:20:47","modified_gmt":"2014-05-24T20:20:47","slug":"when-memory-leaks","status":"publish","type":"post","link":"https:\/\/www.wambooli.com\/blog\/?p=6120","title":{"rendered":"When Memory Leaks"},"content":{"rendered":"<p>While my favorite PC term happens to be <em>dump<\/em>, I also hold some fondness for the term <em>leak<\/em>. Specifically, a <em>memory leak<\/em>.<br \/>\n<!--more--><br \/>\nSuffering from some leaky faucets recently, I got to thinking about all types of leaks.<\/p>\n<p>As an example, faucets leak. When plumbing goes awry, water goes everywhere. It&#8217;s a mess.<\/p>\n<p>Yet, when electricity goes awry, it doesn&#8217;t leak, does it? In fact, the scary thing is that electrical malfunctions can cause fires. I suppose that&#8217;s a type of &#8220;leak,&#8221; although the power lines aren&#8217;t funneling flames of death all over town. In fact, electricity may leak out of open sockets and we&#8217;d never know it.<\/p>\n<p>All that nonsense aside, a computer <em>memory leak<\/em> is something you definitely know about. While they aren&#8217;t as common as they once were, such leaks are entirely possible.<\/p>\n<p>Basically, a memory leak is a bug. It happens when programs don&#8217;t keep track of how they use memory. The &#8220;leak&#8221; occurs when the program keeps asking for more and more memory, or it keeps consuming memory until capacity is reached. Then the entire system comes crashing down.<\/p>\n<p>Memory leaks were more common back in the Days of DOS. Back then, a single program took control over the entire computer. Memory wasn&#8217;t dished out, neither was memory protected. Instead, the operating system (DOS) said, &#8220;Hey! Here is all the hardware. Do your worst.&#8221;<\/p>\n<p>Somewhere deep in the code, the programmer forgot to dot an I or cross a T. A request was made for a chunk of memory over and over again. Gradually, all memory would disappear.<\/p>\n<p>Memory leaks went undetected as long as the program had room to bloat. So a small program, say a text editor or utility, could run safely, leaking memory like a sieve, and you&#8217;d never know. The program would quit, and memory would be released.<\/p>\n<p>When a memory-leaking program ran longer, the problem became more noticeable. Eventually a <code>Memory Error<\/code> would occur and the system crashed.<\/p>\n<p>You might think that with today&#8217;s computers, with their greater memory capacity, it would take even longer to discover a memory leak.<\/p>\n<p>Not so!<\/p>\n<p>Modern operating systems allocate memory under guidelines more strict than Edna the Lunch Lady doles out the cherry jello. Programs that violate the rules, leaking memory like a dripping faucet, are contained. The operating system catches the leak, halts the program, and that&#8217;s that.<\/p>\n<p>Command line programs that leak generate a <code>Segmentation Fault<\/code> error. (If you&#8217;re a programmer, I&#8217;m sure you&#8217;ve seen a few of those.) Other programs simply shutdown with a generic operating system message, such as &#8220;The program `Blorfus` has stopped working and will be shut down.&#8221; That message is bland, so the problem might not be a memory leak, but it could be.<\/p>\n<p>Can you fix a memory leak? Nope. Only the programmer can address the issue. So put away that pan and never mind the towel. Memory leaks may happen, but fortunately they&#8217;re far less frequent than in days past.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can&#8217;t fix a computer memory leak by putting a pan under the console.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-6120","post","type-post","status-publish","format-standard","hentry","category-main"],"_links":{"self":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6120"}],"version-history":[{"count":2,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6120\/revisions"}],"predecessor-version":[{"id":6139,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6120\/revisions\/6139"}],"wp:attachment":[{"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wambooli.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}