{"id":232,"date":"2009-10-16T08:15:26","date_gmt":"2009-10-16T08:15:26","guid":{"rendered":"https:\/\/kari.world.ikari.fi\/2009\/10\/16\/thanks-for-the-memory\/"},"modified":"2009-10-16T08:15:26","modified_gmt":"2009-10-16T08:15:26","slug":"thanks-for-the-memory","status":"publish","type":"post","link":"https:\/\/kari.world.ikari.fi\/?p=232","title":{"rendered":"Thanks for the memory"},"content":{"rendered":"<p><a href=\"http:\/\/www.ibm.com\/developerworks\/linux\/library\/j-nativememory-linux\/index.html\">Thanks for the memory<\/a><\/p>\n<p>Some interesting points:<\/p>\n<p>1:<\/p>\n<blockquote><p>\n&#8230; When a JVM&#8217;s Java heap is swapped out, the garbage collector&#8217;s performance becomes extremely poor, to the extent that the application can appear to hang. If multiple Java runtimes are in use on a single machine at the same time, the physical memory must be sufficient to fit all of the Java heaps. &#8230;\n<\/p><\/blockquote>\n<p>2:<\/p>\n<blockquote><p>\n&#8230; Each Java thread requires stack space. Stack size varies among implementations, but with default settings, each thread could occupy up to 756KB of native memory. &#8230;\n<\/p><\/blockquote>\n<p>3:<\/p>\n<blockquote><p>\n<a href=\"http:\/\/download.boulder.ibm.com\/ibmdl\/pub\/software\/dw\/jdk\/diagnosis\/dw3gbswitch3.pdf\">&#8221;Windows Java address space&#8221;<\/a> (Phil Vickers and Amar Devegowda, IBM Java Technology Centre, December 2005): Find out how to maximize the IBM Java memory address space on 32-bit Windows systems.<\/p>\n<blockquote><p>\n<b>&#8230; Recall that the Java heap must be a contiguous space and that its practical max size is around 1.5 GB. &#8230;<\/b>\n<\/p><\/blockquote>\n<\/blockquote>\n<p>Update: <strong>5.12.2009<\/strong><br \/>\nMysteries of &#8221;cannot create new native thread&#8221;. Why such things occurs?<\/p>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/561245\/virtual-memory-usage-from-java-under-linux-too-much-memory-used\">Virtual Memory Usage from Java under Linux, too much memory used<\/a><br \/>\n<a href=\"http:\/\/alek.xspaces.org\/2005\/06\/java-thread-stack-size\">Java and default stack size for threads: 0.4MB, 1MB, or 8MB?<\/a><br \/>\n<a href=\"http:\/\/answers.google.com\/answers\/threadview\/id\/311442.html\">Understanding ulimit output<\/a><br \/>\n<a href=\"http:\/\/forums.sun.com\/thread.jspa?threadID=5359848\">Are +&#8221;Xss&#8221; +&#8221;ThreadStackSize&#8221; the same?<\/a><br \/>\n<a href=\"http:\/\/java.sun.com\/javase\/6\/webnotes\/trouble\/TSG-VM\/html\/memleaks.html\">Troubleshooting Memory Leaks<\/a><\/p>\n<p>Quickly poking around, it appears that it would be usefull to peek into <code>pmap<\/code> output for process. In my linux box it appears that &#8221;pmap -x PID | grep 308 | wc -l&#8221; corresponds very closely into amount of threads in application (308 being memory allocated to some mysterious &#8221;anon&#8221;, actually there is 12 + 308 per thread in pmap).<\/p>\n<p>So it looks like in this system, each thread is consuming 320 KB of native memory. However, interestingly, after some tens of threads had been terminated in java, these 12+308 blocks of memory still haven&#8217;t been released. Is that some memory leak bug in Sun 1.6.0 JVM?<\/p>\n<p><strong>Update: 13.3.2010<\/strong><br \/>\n<a href=\"http:\/\/www.dynatrace.com\/en\/memory-diagnosis-leak-detection.aspx\">Memory Leak Detection &amp; Memory Diagnosis<\/a><br \/>\n<a href=\"http:\/\/blog.codecentric.de\/en\/2010\/01\/java-outofmemoryerror-1-akt-das-java-memory-modell-stellt-sich-vor\/#comments\">Das Java Memory Modell (1. Akt)<\/a><\/p>\n<p><strong>Update: 12.6.2010<\/strong><br \/>\n<a href=\"http:\/\/www.slideshare.net\/gengmao\/java-memeory-overview-public\">Java Memeory Overview Public<\/a><br \/>\n<a href=\"http:\/\/wiki.eclipse.org\/index.php\/MemoryAnalyzer\">Eclipse MemoryAnalyzer<\/a><br \/>\n<a href=\"http:\/\/ampedandwired.com\/?p=7\">Finding PermGen Memory Leaks with YourKit<\/a><br \/>\n<a href=\"http:\/\/www.slideshare.net\/gengmao\/inside-the-jvm-memory-management-and-troubleshooting\">Inside The Jvm Memory Management And Troubleshooting<\/a><br \/>\n<a href=\"http:\/\/rajakannappan.blogspot.com\/2010\/01\/outofmemoryerror-on-heapspace-permgen.html\">OutOfMemoryError (on HeapSpace, PermGen) and JVM Performance Tuning<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thanks for the memory Some interesting points: 1: &#8230; When a JVM&#8217;s Java heap is swapped out, the garbage collector&#8217;s performance becomes extremely poor, to the extent that the application can appear to hang. If multiple Java runtimes are in use on a single machine at the same time, the physical memory must be sufficient&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-232","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts\/232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=232"}],"version-history":[{"count":0,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=\/wp\/v2\/posts\/232\/revisions"}],"wp:attachment":[{"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kari.world.ikari.fi\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}