{"id":10,"date":"2005-08-05T20:15:18","date_gmt":"2005-08-05T19:15:18","guid":{"rendered":"http:\/\/www.epischel.de\/wordpress\/?p=10"},"modified":"2012-04-09T11:42:17","modified_gmt":"2012-04-09T10:42:17","slug":"using-a-garbage-collector-doesnt-free-you-from-thinking","status":"publish","type":"post","link":"https:\/\/www.epischel.de\/wordpress\/2005\/08\/using-a-garbage-collector-doesnt-free-you-from-thinking\/","title":{"rendered":"Using a Garbage Collector doesn&#8217;t free you from thinking"},"content":{"rendered":"<p><em>about references<\/em>. Memory leaks are still possible &#8211; if an object has a &#8222;reachable&#8220;  reference (whatever that is in your context)  it won&#8217;t be garbage collected. You still have to think about who references your objects and how long.<\/p>\n<p>For instance, in my current project using Java Swing, someone said<\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">java<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"java\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">getCurrentFocusManager<span style=\"color: #009900\">&#040;<\/span><span style=\"color: #009900\">&#041;<\/span>.<span style=\"color: #006633\">addKeyEventDispatcher<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #000000;font-weight: bold\">this<\/span><span style=\"color: #009900\">&#041;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>in a constructor. Then we got reports OutOfMemory-Error. A simple<\/p>\n<div id=\"ig-sh-2\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">java<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"java\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">getCurrentFocusManager<span style=\"color: #009900\">&#040;<\/span><span style=\"color: #009900\">&#041;<\/span>.<span style=\"color: #006633\">removeKeyEventDispatcher<\/span><span style=\"color: #009900\">&#040;<\/span><span style=\"color: #000000;font-weight: bold\">this<\/span><span style=\"color: #009900\">&#041;<\/span><span style=\"color: #339933\">;<\/span><\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>solved this issue. <\/p>\n<p>It&#8217;s harder than you think!<\/p>\n<div class=\"syndication-links\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Using a Garbage Collector doesn&#8217;t free you from thinking about references<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"mf2_syndication":[],"webmentions_disabled_pings":false,"webmentions_disabled":false,"footnotes":""},"categories":[3],"tags":[120,119],"series":[],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-java","tag-java","tag-entwicklung","kind-"],"kind":false,"_links":{"self":[{"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":3,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":333,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/posts\/10\/revisions\/333"}],"wp:attachment":[{"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/tags?post=10"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.epischel.de\/wordpress\/wp-json\/wp\/v2\/series?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}