<?xml version="1.0"?><!-- RSS generated by Radio UserLand v8.1 on Mon, 14 Mar 2005 03:18:09 GMT --><rss version="2.0">	<channel>		<title>Moazam Raja: JVM Internals</title>		<link>http://www.unixville.com/~moazam/categories/jvmInternals/</link>		<description>concerning the internal workings of the Sun Java Virtual Machine</description>		<copyright>Copyright 2005 Moazam Raja</copyright>		<lastBuildDate>Mon, 14 Mar 2005 03:18:09 GMT</lastBuildDate>		<docs>http://backend.userland.com/rss</docs>		<generator>Radio UserLand v8.1</generator>		<managingEditor>moazam@unixville.com</managingEditor>		<webMaster>moazam@unixville.com</webMaster>		<category domain="http://www.weblogs.com/rssUpdates/changes.xml">rssUpdates</category> 		<skipHours>			<hour>0</hour>			<hour>2</hour>			<hour>3</hour>			<hour>4</hour>			<hour>5</hour>			<hour>6</hour>			<hour>7</hour>			<hour>8</hour>			</skipHours>		<ttl>60</ttl>		<item>			<title>Why can&apos;t I allocate 2GB of heap to the JVM on Windows, Part 2</title>			<description>I got an email from Fredrik Paulsson asking about my previousentryconcerning &quot;&lt;a href=&quot;http://www.unixville.com/%7Emoazam/2004/06/03.html&quot;&gt;Why can&apos;tIallocate 2GB of heap to the JVM on Windows?&lt;/a&gt;&quot; Fredrik (andothers)have asked about the new /3GB and /PAE switches available in certainreleases of Windows (2000/2003, AS/ES).&lt;br&gt;&lt;p&gt;There is a &lt;a href=&quot;http://www.microsoft.com/whdc/system/platform/server/PAE/PAEmem.mspx&quot;&gt;descriptionof the /3GB switch&lt;/a&gt; over at the Microsoft website.&lt;br&gt;&lt;br&gt;Anyways, the use of this switch&lt;b&gt;does not&lt;/b&gt; enable the JVM toallocate more than 2GB heap on Windows. Why? To the best of myknowledge,the Java VirtualMachine wants a &lt;b&gt;contiguous&lt;/b&gt; allocation of memory. The/3GB switchin Windows does not allow that. The use of non-contiguous memory spacefor the 32bit JVM would most probably cause performance issues. Can youimagine doing garbage collection over 3GB of non-contiguousRAM? *shudder*&lt;br&gt;&lt;br&gt;PS&amp;gt; One of the Java VM gods here at Sun confirmed this with thefollowing:&lt;br&gt;&lt;br&gt;&quot;&lt;i&gt;The reason we need a contiguous memory region for the heap is that wehave a bunch of side data structures that are indexed by (scaled)offsets from the start of the heap. For example, we track objectreference updates with a &quot;card mark array&quot; that has one byte for each512 bytes of heap. When we store a reference in the heap we have tomark the corresponding byte in the card mark array. We right shift thedestination address of the store and use that to index the card markarray. Fun addressing arithmetic games you can&apos;t do in Java that youget to (have to :-) play in C++.&lt;/i&gt;&lt;br&gt;&lt;br&gt;&lt;i&gt;Usually we don&apos;t have troublegetting modest contiguous regions (upto about 1.5GB on Windohs, up to about 3.8GB on Solaris. YMMV.). OnWindohs, the problem is mostly that there are some libraries that getloaded before the JVM starts up that break up the address space. Usingthe /3GB switch won&apos;t rebase those libraries, so they are still aproblem for us.&lt;/i&gt;&lt;br&gt;&lt;br&gt;&lt;i&gt;We know how to make chunkedheaps, but there would be some overheadto using them. We have more requests for faster storage management thanwe do for larger heaps in the 32-bit JVM. If you really want largeheaps, switch to the 64-bit JVM. We still need contiguous memory, butit&apos;s much easier to get in a 64-bit address space.&lt;/i&gt;&lt;br&gt;&lt;br&gt;&lt;i&gt;I hope thathelps&lt;/i&gt;&lt;/p&gt;&lt;i&gt;... peter &lt;/i&gt;&quot;&lt;br&gt;</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2005/03/13.html#a32</guid>			<pubDate>Mon, 14 Mar 2005 03:16:06 GMT</pubDate>			</item>		<item>			<title>Logging GC output to a file, the differences between Xloggc and verbose:gc</title>			<description>&lt;br&gt;I&apos;m sure people have noticed this little idiosyncrasy in the way that garbage collection log output is handled in the JVM. But if you have not, this is a good data point when preparing to read through GC logs.If you simply use the &lt;b&gt;verbose:gc&lt;/b&gt; flag, you&apos;ll have GC log output sent to the stdout console. Now, if you use the &lt;b&gt;-Xloggc:[&lt;i&gt;filename&lt;/i&gt;]&lt;/b&gt; switch, the GC data will be sent to a log file which you can grep through later. But either way, you get the the same GC data ...right? &lt;b&gt;Wrong&lt;/b&gt;. The &lt;b&gt;-Xloggc:[&lt;i&gt;filename&lt;/i&gt;]&lt;/b&gt; switch has the additional effect of turning on the &lt;b&gt;-XX:+PrintGCTimeStamps&lt;/b&gt; switch and hence gives your log files the added benefit of time stamps. Wierd! I&apos;d expect both of these switches to have the same exact behavior. I might file an RFE or Bug on this tonight.Oh, for those who want to use it, the &lt;b&gt;-Xloggc&lt;/b&gt; switch was introduced in 1.4.0 and newer VMs.</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2004/06/09.html#a30</guid>			<pubDate>Wed, 09 Jun 2004 23:18:49 GMT</pubDate>			</item>		<item>			<title>View from the Trenches: Looking at Thread-Dumps, by Alexandre Rafalovitch</title>			<link>http://dev2dev.bea.com/products/wlplatform81/articles/thread_dumps.jsp</link>			<description>&lt;br&gt;Alexandre Rafalovitch, a BEA Backline Support Engineer emailed me about reading thread dumps and his proposal for formatting dump data. I&apos;ve read through &lt;a href=&quot;http://dev2dev.bea.com/products/wlplatform81/articles/thread_dumps.jsp&quot;&gt;Alexandres article&lt;/a&gt;, and while I&apos;m not a big fan of using XML for everything, he definitely presents an excellent view on making thread dumps easier to read and diagnose. The really cool part is that Alexandre has written &lt;a href=&quot;http://dev2dev.bea.com/resourcelibrary/utilitiestools/monitoring.jsp&quot;&gt;an application&lt;/a&gt; which takes standard thread dump data, converts it into XML, then uses XSLT to convert the data into the format of your choice.I&apos;m actually a bit surprised that there isn&apos;t a JSR in progress to address this issue. I think one of the reasons for this is that most developers and users are not interested in the nuances of thread dump readability. Of course, as backline engineers, this topic is near and dear to myself and Alexandre. Alexandre will be presenting this in a session at JavaONE 2004, session TS-1646. I&apos;ll be sure to attend. &lt;br&gt;&lt;br&gt;&lt;i&gt;&quot;What would be a perfect solution here is to be able to convert these thread-dumps into some sort of intermediate structure/language that has flexible structure, can tolerate missing fields, and can be processed by third-party tools in various ways. And, of course, if it can somehow involve a currently popular technology, so much the better.Do we have such an intermediate language? Indeed we do &amp;oacute; it is XML. It is somewhat human readable, has many tools written for it, and already has not one but several transformation and reporting technologies built on top of it, such as XSLT, XQuery, and XDB.&quot;&lt;/i&gt; &lt;a href=&quot;http://dev2dev.bea.com/products/wlplatform81/articles/thread_dumps.jsp&quot;&gt;[full article]&lt;/a&gt;</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2004/06/08.html#a29</guid>			<pubDate>Wed, 09 Jun 2004 07:00:40 GMT</pubDate>			</item>		<item>			<title>Why can&apos;t I allocate 2GB of heap to the JVM on Windows?</title>			<description>&lt;br&gt;It is a known fact that 32bit architectures limit the amount of memory any single process can allocate to 4GB. So why does the JVM limit the maximum heap size (-Xmx) to &lt;b&gt;under&lt;/b&gt; 2GB?&lt;br&gt;&lt;br&gt;When you try to run your JVM with a -Xmx2gb flag, you&apos;ll get the following error:&lt;br&gt;&lt;br&gt;&lt;i&gt;Error occurred during initialization of VM&lt;br&gt;Could not reserve enough space for object heap&lt;/i&gt;&lt;br&gt;&lt;br&gt;This is a limitation of the Windows 32bit OS. 32bit processes can only use a max of 4GB memory address space. Windows further splits that into half by allocating 2GB to the kernel and 2GB to the application.&lt;br&gt;&lt;br&gt;The reason you can not hit the 2GB limit within the VM is because there is memory overhead that the VM and OS use for the process (remember &lt;a href=&quot;http://www.unixville.com/~moazam/stories/2004/05/17/maxpermsizeAndHowItRelatesToTheOverallHeap.html&quot;&gt;MaxPermSize&lt;/a&gt;?), hence you end up with a bit less than the actual 2GB limit.&lt;br&gt;&lt;br&gt;The solution would be to move to a 64bit machine and OS.</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2004/06/03.html#a26</guid>			<pubDate>Thu, 03 Jun 2004 23:10:05 GMT</pubDate>			</item>		<item>			<title>1.4.2 Tuning Garbage Collection Outline</title>			<link>http://www.petefreitag.com/articles/gctuning/</link>			<description>&lt;br&gt;This has to be one of the most useful outlines of GC tuning information I have ever seen. Thanks to Pete Freitag for creating this from the &lt;a href=&quot;http://java.sun.com/docs/hotspot/gc1.4.2/&quot;&gt;original document&lt;/a&gt;. The original was nowhere as easy to read.</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2004/06/03.html#a24</guid>			<pubDate>Thu, 03 Jun 2004 21:57:49 GMT</pubDate>			</item>		<item>			<title>Debugging Backwards in Time - Omniscient Debugging</title>			<link>http://www.lambdacs.com/debugger/debugger.html</link>			<description>&lt;br&gt;I can&apos;t believe that I didn&apos;t know about this before! ODB allows you to do &apos;Omniscient Debugging&apos; on Java applications, with or without the original source code.The ODB debugger allows &quot;..developers to step backwards through the execution of a program to determine where and how programming errors occurred. By recording each state change in the target application, it allows the developer to navigate &quot;backwards in time&quot; to see what the values of variables and objects WERE, enormously simplifying the task of debugging programs.&quot;&lt;a href=&quot;http://www.lambdacs.com/debugger/ODBDescription.html&quot;&gt;One page description of the ODB&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.lambdacs.com/debugger/Article.html&quot;&gt;Article , Debugging Backwards in Time&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.lambdacs.com/debugger/AADEBUG_Mar_03.pdf&quot;&gt;AADEBUG paper on Omniscient Debugging (pdf)&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.lambdacs.com/debugger/UserManual/ODBUserManual.html&quot;&gt;ODB User Manual&lt;/a&gt;</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2004/06/01.html#a20</guid>			<pubDate>Tue, 01 Jun 2004 19:15:53 GMT</pubDate>			</item>		<item>			<title>Download the source code of the Java SDK</title>			<link>http://wwws.sun.com/software/communitysource/j2se/java2//download.html</link>			<description>&lt;br&gt;Want to look at the code of the JVM or build a test version of your own? Use the source. And look, detailed build instructions are available too!</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2004/05/31.html#a19</guid>			<pubDate>Tue, 01 Jun 2004 00:48:35 GMT</pubDate>			</item>		<item>			<title>Debugging thread related hangs in the JVM</title>			<link>http://www.unixville.com/~moazam/stories/2004/05/18/debuggingHangsInTheJvm.html</link>			<description>&lt;br&gt;Once in a while Java users and developers run into problems where their Java application simply seems to hang. No core file is generated, no IO is detected, the process just sits there waiting...for something. Usually these problems can be traced to OS and JVM level threading.</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2004/05/25.html#a16</guid>			<pubDate>Tue, 25 May 2004 22:27:49 GMT</pubDate>			</item>		<item>			<title>Visualizing Garbage Collection with jvmstat</title>			<link>http://www.unixville.com/~moazam/stories/2004/05/18/visualizingGarbageCollection.html</link>			<description>&lt;br&gt;There are times when reading through megabytes of GC logs is overkill, especially when all you need is a general overview on how the JVMs GC algorithms are behaving with your application. The &apos;&lt;a href=&quot;http://developers.sun.com/dev/coolstuff/jvmstat/&quot;&gt;jvmstat&lt;/a&gt;&apos; package helps developers and users visualize GC instead.&lt;br&gt;&lt;a href=&quot;http://www.unixville.com/~moazam/stories/2004/05/18/visualizingGarbageCollection.html&quot;&gt;&lt;img src=&quot;http://www.unixville.com/~moazam/images/moazam/visualgcSmall.png&quot; border=&quot;1&quot;&gt;&lt;/a&gt;</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2004/05/18.html#a15</guid>			<pubDate>Tue, 18 May 2004 22:31:21 GMT</pubDate>			</item>		<item>			<title>J2SE Code Names</title>			<link>http://java.sun.com/j2se/codenames.html</link>			<description>This little list helps to make sense of those J2SE BugIDs which reference J2SE code names.&lt;table cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; style=&quot;margin-left:4em;&quot;&gt;&lt;tr&gt;&lt;th align=&quot;left&quot; style=&quot;font-size:95%; border-bottom-width:medium; border-bottom-width: 1px; border-bottom-style: solid;&quot;&gt;&lt;b&gt;VERSION&lt;/b&gt;&lt;/th&gt;&lt;th align=&quot;left&quot; style=&quot;font-size:95%; border-bottom-width:medium; border-bottom-width: 1px; border-bottom-style: solid;&quot;&gt;&lt;b&gt;CODE NAME&lt;/b&gt;&lt;/th&gt;&lt;th align=&quot;center&quot; style=&quot;font-size:95%; border-bottom-width:medium; border-bottom-width: 1px; border-bottom-style: solid;&quot;&gt;&amp;nbsp;&amp;nbsp;&lt;b&gt;RELEASE DATE&lt;/b&gt;&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;JDK 1.1.4&lt;/td&gt;&lt;td&gt;Sparkler&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;Sept 12, 1997&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;JDK 1.1.5&lt;/td&gt;&lt;td&gt;Pumpkin&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;Dec 3, 1997&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;JDK 1.1.6&lt;/td&gt;&lt;td&gt;Abigail&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;April 24, 1998&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;JDK 1.1.7&lt;/td&gt;&lt;td&gt;Brutus&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;Sept 28, 1998&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;JDK 1.1.8&lt;/td&gt;&lt;td&gt;Chelsea&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;April 8, 1999&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;J2SE 1.2&lt;/td&gt;&lt;td&gt;&lt;b&gt;Playground&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;b&gt;Dec 4, 1998&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;J2SE 1.2.1&lt;/td&gt;&lt;td&gt;(none)&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;March 30, 1999&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;J2SE 1.2.2&lt;/td&gt;&lt;td&gt;Cricket&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;July 8, 1999&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;J2SE 1.3&lt;/td&gt;&lt;td&gt;&lt;b&gt;Kestrel&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;b&gt;May 8, 2000&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;J2SE 1.3.1&lt;/td&gt;&lt;td&gt;Ladybird&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;May 17, 2001&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;J2SE 1.4.0&lt;/td&gt;&lt;td&gt;&lt;b&gt;Merlin&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;b&gt;Feb 13, 2002&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;J2SE 1.4.1&lt;/td&gt;&lt;td&gt;Hopper&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;Sept 16, 2002&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;J2SE 1.4.2&lt;/td&gt;&lt;td&gt;Mantis&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;June 26, 2003&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=2&gt;&lt;br&gt;&lt;b&gt;Future Releases&lt;/b&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;J2SE 1.5.0&lt;/td&gt;&lt;td&gt;&lt;b&gt;Tiger&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;i&gt;Not yet released&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;J2SE 1.5.1&lt;/td&gt;&lt;td&gt;Dragonfly (dragon)&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;i&gt;Not yet released&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;b&gt;J2SE 1.6.0&lt;/td&gt;&lt;td&gt;&lt;b&gt;Mustang&lt;/td&gt;&lt;td align=&quot;right&quot;&gt;&lt;i&gt;Not yet released&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2004/05/17.html#a12</guid>			<pubDate>Tue, 18 May 2004 07:42:02 GMT</pubDate>			</item>		<item>			<title> MaxPermSize and how it relates to the overall heap</title>			<link>http://www.unixville.com/~moazam/stories/2004/05/17/maxpermsizeAndHowItRelatesToTheOverallHeap.html</link>			<description>&lt;br&gt;Many people have asked if the MaxPermSize value is a part of the overall -Xmx heap setting or additional to it. There is a GC document on the Sun website which is causing some confusion due to a somewhat vague explanation and an errant diagram. The more I look at this document, the more I think the original author has made a subtle mistake in describing -Xmx as it relates to the PermSize and MaxPermSize.</description>			<guid>http://www.unixville.com/~moazam/categories/jvmInternals/2004/05/17.html#a7</guid>			<pubDate>Tue, 18 May 2004 00:23:09 GMT</pubDate>			</item>		</channel>	</rss>