{"id":98125,"date":"2018-02-28T07:00:00","date_gmt":"2018-02-28T22:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/?p=98125"},"modified":"2019-03-13T01:01:42","modified_gmt":"2019-03-13T08:01:42","slug":"20180228-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20180228-00\/?p=98125","title":{"rendered":"An amusing story about a practical use of the null garbage collector"},"content":{"rendered":"<p>Some time ago, I noted that <a HREF=\"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/20100809-00\/?p=13203\">the null garbage collector is a valid garbage collector<\/a> if the amount of RAM available to the runtime is greater than the total memory requirements of the program. This insight lets us make some statements about what you can assume from garbage-collected languages. <\/p>\n<p>But it also can be looked at as rules for deciding when you can simply ignore the memory leaks in your program and just use a null garbage collector. Here&#8217;s <a HREF=\"https:\/\/groups.google.com\/forum\/message\/raw?msg=comp.lang.ada\/E9bNCvDQ12k\/1tezW24ZxdAJ\">one developer who learned about an application of this principle<\/a>: <\/p>\n<pre>\nFrom: k...@rational.com (Kent Mitchell)\nSubject: Re: Does memory leak?\nDate: 1995\/03\/31\n\nNorman H. Cohen (nco...@watson.ibm.com) wrote:\n: The only programs I know of with deliberate memory leaks are those whose\n: executions are short enough, and whose target machines have enough\n: virtual memory space, that running out of memory is not a concern.\n: (This class of programs includes many student programming exercises and\n: some simple applets and utilities; it includes few if any embedded or\n: safety-critical programs.)\n\nThis sparked an interesting memory for me.  I was once working with a\ncustomer who was producing on-board software for a missile.  In my analysis\nof the code, I pointed out that they had a number of problems with storage\nleaks.  Imagine my surprise when the customers chief software engineer said\n\"Of course it leaks\".  He went on to point out that they had calculated the\namount of memory the application would leak in the total possible flight time\nfor the missile and then doubled that number.  They added this much\nadditional memory to the hardware to \"support\" the leaks.  Since the missile\nwill explode when it hits its target or at the end of its flight, the\nultimate in garbage collection is performed without programmer intervention.\n\n--\nKent Mitchell                   | One possible reason that things aren't\nTechnical Consultant            | going according to plan is .....\nRational Software Corporation   | that there never *was* a plan!\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The computer itself ceases to exist.<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[2],"class_list":["post-98125","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>The computer itself ceases to exist.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/98125","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=98125"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/98125\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=98125"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=98125"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=98125"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}