{"id":4700,"date":"2024-12-30T02:06:43","date_gmt":"2024-12-30T09:06:43","guid":{"rendered":"https:\/\/www.sheer.us\/weblogs\/?p=4700"},"modified":"2024-12-30T02:06:43","modified_gmt":"2024-12-30T09:06:43","slug":"memory-leaks-in-perl","status":"publish","type":"post","link":"http:\/\/www.sheer.us\/weblogs\/programming\/perl\/memory-leaks-in-perl","title":{"rendered":"Memory leaks in perl"},"content":{"rendered":"<p>So, I&#8217;ve been maintaining several very large projects in perl &#8211; I can enumerate them at a later date &#8211; and one of them in perl and XS. Interestingly, the one in perl and XS is the first to have significant memory leaks &#8211; but they&#8217;re not all from XS!<\/p>\n<p>I&#8217;ve identified three types of memory leaks<\/p>\n<p>#1) Scalers leaving XS without being made mortal and given a reasonable refcount. A useful tool for looking for these is Devel::Leak<br \/>\n#2) Circular references that are not weakened and therefore can never be reaped. A useful tool for looking for these is Devel::Cycle<br \/>\n#3) Scalers gaining a refcount that is not being cleared. A useful tool for looking for these is also Devel::Leak<\/p>\n<p>I now need to go through all the major subsystems and make sure that they aren&#8217;t leaking one of these ways. If I find new ways to leak I will add them to this document. Comment below if you&#8217;d like a more comprehensive document on how to find these things.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, I&#8217;ve been maintaining several very large projects in perl &#8211; I can enumerate them at a later date &#8211; and one of them in perl and XS. Interestingly, the one in perl and XS is the first to have significant memory leaks &#8211; but they&#8217;re not all from XS! I&#8217;ve identified three types of [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36,4],"tags":[],"_links":{"self":[{"href":"http:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/posts\/4700"}],"collection":[{"href":"http:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/comments?post=4700"}],"version-history":[{"count":1,"href":"http:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/posts\/4700\/revisions"}],"predecessor-version":[{"id":4701,"href":"http:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/posts\/4700\/revisions\/4701"}],"wp:attachment":[{"href":"http:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/media?parent=4700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/categories?post=4700"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sheer.us\/weblogs\/wp-json\/wp\/v2\/tags?post=4700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}