<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: 32-bit versus 64-bit JDK Memory Usage</title>
	<atom:link href="http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/feed/" rel="self" type="application/rss+xml" />
	<link>http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/</link>
	<description>Software Development and Other Random Stuff</description>
	<lastBuildDate>Tue, 20 Dec 2011 06:03:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Ben Christensen</title>
		<link>http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-503</link>
		<dc:creator><![CDATA[Ben Christensen]]></dc:creator>
		<pubDate>Mon, 27 Jun 2011 18:24:53 +0000</pubDate>
		<guid isPermaLink="false">http://benjchristensen.wordpress.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-503</guid>
		<description><![CDATA[Dave,

You are definitely correct in referencing the Oracle FAQ that primitives do NOT increase, but the pointers (object references) do.

4+ years ago when I wrote this there were several situations I was in where misunderstanding existed as to why apps were running out of memory when switching from 32-bit to 64-bit, or why a 64-bit app required more memory than running in 32-bit mode.

Hence the writeup to basically provide a practical example of how to “calculate” the average increase in memory an application would need from going to 64-bit and more importantly to prove that it was something to be expected and not a “fault” of a given application. It is by no means concrete and it fully depends on what you’re doing in the app.

If an app has a single object that contains an primitive byte[10000000] array then obviously the “average” of my calculations will not apply, but that’s also not how most objects/primitives exist in typical apps.

Every app would need to do their own testing and every developer needs to understand the difference between primitives and objects in Java.

Hope this helps provide some context.

Ben]]></description>
		<content:encoded><![CDATA[<p>Dave,</p>
<p>You are definitely correct in referencing the Oracle FAQ that primitives do NOT increase, but the pointers (object references) do.</p>
<p>4+ years ago when I wrote this there were several situations I was in where misunderstanding existed as to why apps were running out of memory when switching from 32-bit to 64-bit, or why a 64-bit app required more memory than running in 32-bit mode.</p>
<p>Hence the writeup to basically provide a practical example of how to “calculate” the average increase in memory an application would need from going to 64-bit and more importantly to prove that it was something to be expected and not a “fault” of a given application. It is by no means concrete and it fully depends on what you’re doing in the app.</p>
<p>If an app has a single object that contains an primitive byte[10000000] array then obviously the “average” of my calculations will not apply, but that’s also not how most objects/primitives exist in typical apps.</p>
<p>Every app would need to do their own testing and every developer needs to understand the difference between primitives and objects in Java.</p>
<p>Hope this helps provide some context.</p>
<p>Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-499</link>
		<dc:creator><![CDATA[Dave]]></dc:creator>
		<pubDate>Fri, 24 Jun 2011 07:43:41 +0000</pubDate>
		<guid isPermaLink="false">http://benjchristensen.wordpress.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-499</guid>
		<description><![CDATA[Interesting article. I just read http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#64bit_description and I have a minor nitpic with your conclusion that it is possible to calculate and plan for how much more memory you&#039;ll need for a 64 bit deployment - it is not primitives that are larger but pointers, so the amount of extra memory needed will fluctuate according to the number of allocations your software makes.]]></description>
		<content:encoded><![CDATA[<p>Interesting article. I just read <a href="http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#64bit_description" rel="nofollow">http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#64bit_description</a> and I have a minor nitpic with your conclusion that it is possible to calculate and plan for how much more memory you&#8217;ll need for a 64 bit deployment &#8211; it is not primitives that are larger but pointers, so the amount of extra memory needed will fluctuate according to the number of allocations your software makes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JDK memory usage on various versions and bit types &#187; devnumbertwo</title>
		<link>http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-477</link>
		<dc:creator><![CDATA[JDK memory usage on various versions and bit types &#187; devnumbertwo]]></dc:creator>
		<pubDate>Mon, 28 Feb 2011 18:39:23 +0000</pubDate>
		<guid isPermaLink="false">http://benjchristensen.wordpress.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-477</guid>
		<description><![CDATA[[...] http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/ [...]]]></description>
		<content:encoded><![CDATA[<p>[...] <a href="http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/" rel="nofollow">http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Netbeans mit 32bit Java auf 64bit Fedora Linux (GNOME) » Fedora-Blog.de</title>
		<link>http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-476</link>
		<dc:creator><![CDATA[Netbeans mit 32bit Java auf 64bit Fedora Linux (GNOME) » Fedora-Blog.de]]></dc:creator>
		<pubDate>Sun, 27 Feb 2011 13:58:41 +0000</pubDate>
		<guid isPermaLink="false">http://benjchristensen.wordpress.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-476</guid>
		<description><![CDATA[[...] Netbeans mit 32bit Java auf 64bit Fedora Linux (GNOME)  Publiziert am 27. Februar 2011 von vinz   TweetIch verdiene meine Brötchen ja damit, dass ich Java-Code eintippe. Damit das möglichst schnell geht brauche ich viel viel Speicher und eine schnelle CPU. Aktuelle Rechner sind prädestiniert für 64bit Betriebssysteme und Anwendungen. Allerdings hat die Java-Laufzeitumgebung ein Problem, nämlich dass die 64bit-Variante ziemlich deutlich mehr Speicher verbraucht als die 32bit-Version. Die Ursache liegt in den doppelt so großen Pointern (8 Byte statt 4 Byte) die für jedes Objekt (und das sind viele) erzeugt werden. In meiner Erfahrung fressen Netbeans zusammen mit Tomcat, Spring, Hibernate, etc. bei einer 64-bittigen VM schnell mal 2 GB wo die 32-Bit-Variante nur 1GB braucht. Zu dem Thema gibt es auch einen recht informativen Post. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Netbeans mit 32bit Java auf 64bit Fedora Linux (GNOME)  Publiziert am 27. Februar 2011 von vinz   TweetIch verdiene meine Brötchen ja damit, dass ich Java-Code eintippe. Damit das möglichst schnell geht brauche ich viel viel Speicher und eine schnelle CPU. Aktuelle Rechner sind prädestiniert für 64bit Betriebssysteme und Anwendungen. Allerdings hat die Java-Laufzeitumgebung ein Problem, nämlich dass die 64bit-Variante ziemlich deutlich mehr Speicher verbraucht als die 32bit-Version. Die Ursache liegt in den doppelt so großen Pointern (8 Byte statt 4 Byte) die für jedes Objekt (und das sind viele) erzeugt werden. In meiner Erfahrung fressen Netbeans zusammen mit Tomcat, Spring, Hibernate, etc. bei einer 64-bittigen VM schnell mal 2 GB wo die 32-Bit-Variante nur 1GB braucht. Zu dem Thema gibt es auch einen recht informativen Post. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Christensen</title>
		<link>http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-471</link>
		<dc:creator><![CDATA[Ben Christensen]]></dc:creator>
		<pubDate>Mon, 24 Jan 2011 03:55:21 +0000</pubDate>
		<guid isPermaLink="false">http://benjchristensen.wordpress.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-471</guid>
		<description><![CDATA[Hi guliaiete,

No you don&#039;t need to recompile the java application. Java bytecode can be run in either 32-bit or 64-bit JVMs.

However, running the code on your new machine won&#039;t automatically solve your problem - it&#039;s the JVM arguments that define how much memory the application can use.

Just because the machine has 16GB or 32GB of ram does not mean the java application will have access to it. You must tell the JVM how much memory to allow it to access.

Official documentation can be found here: http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html

-Xmxn
Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is chosen at runtime based on system configuration. For more information, see HotSpot Ergonomics 
Examples:
       -Xmx83886080
       -Xmx81920k
       -Xmx80m

For example, the following will run the app and give it a maximum of 2gb that it can use:

java -Xmx2g com.myapp.MyMain

That can work on most 32-bit JVMs. 

Or, to give 4gb you would do:

java -Xmx4g com.myapp.MyMain


To force an app to 32-bit or 64-bit it can typically be accomplished via arguments such as this:

java -d32 com.myapp.MyMain
java -d64 com.myapp.MyMain

The -server option does the same thing as -d64 on most (if not all) modern JVM installations.

Hope this information helps. Good luck with your app.

Ben]]></description>
		<content:encoded><![CDATA[<p>Hi guliaiete,</p>
<p>No you don&#8217;t need to recompile the java application. Java bytecode can be run in either 32-bit or 64-bit JVMs.</p>
<p>However, running the code on your new machine won&#8217;t automatically solve your problem &#8211; it&#8217;s the JVM arguments that define how much memory the application can use.</p>
<p>Just because the machine has 16GB or 32GB of ram does not mean the java application will have access to it. You must tell the JVM how much memory to allow it to access.</p>
<p>Official documentation can be found here: <a href="http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html" rel="nofollow">http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html</a></p>
<p>-Xmxn<br />
Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is chosen at runtime based on system configuration. For more information, see HotSpot Ergonomics<br />
Examples:<br />
       -Xmx83886080<br />
       -Xmx81920k<br />
       -Xmx80m</p>
<p>For example, the following will run the app and give it a maximum of 2gb that it can use:</p>
<p>java -Xmx2g com.myapp.MyMain</p>
<p>That can work on most 32-bit JVMs. </p>
<p>Or, to give 4gb you would do:</p>
<p>java -Xmx4g com.myapp.MyMain</p>
<p>To force an app to 32-bit or 64-bit it can typically be accomplished via arguments such as this:</p>
<p>java -d32 com.myapp.MyMain<br />
java -d64 com.myapp.MyMain</p>
<p>The -server option does the same thing as -d64 on most (if not all) modern JVM installations.</p>
<p>Hope this information helps. Good luck with your app.</p>
<p>Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: guliaiete</title>
		<link>http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-469</link>
		<dc:creator><![CDATA[guliaiete]]></dc:creator>
		<pubDate>Thu, 20 Jan 2011 15:15:36 +0000</pubDate>
		<guid isPermaLink="false">http://benjchristensen.wordpress.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-469</guid>
		<description><![CDATA[Hi Ben
I have a pure java + Apple Web Object 5.5 web application, right now application is on 32bit processor with 32bit JVM having 16gb ram but still client get &quot;java.lang.OutOfMemoryError: Java heap space&quot; so we are planning to move it on 64bit jvm and 64 bit processor and 32 gb ram. Here my question is will i need to recompile my application before it live on production server or there is no need of recompilation? ..one more thing i want to mention it&#039;s a pure java application no native code. Thanks in advance waiting for your response.]]></description>
		<content:encoded><![CDATA[<p>Hi Ben<br />
I have a pure java + Apple Web Object 5.5 web application, right now application is on 32bit processor with 32bit JVM having 16gb ram but still client get &#8220;java.lang.OutOfMemoryError: Java heap space&#8221; so we are planning to move it on 64bit jvm and 64 bit processor and 32 gb ram. Here my question is will i need to recompile my application before it live on production server or there is no need of recompilation? ..one more thing i want to mention it&#8217;s a pure java application no native code. Thanks in advance waiting for your response.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kumar</title>
		<link>http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-260</link>
		<dc:creator><![CDATA[kumar]]></dc:creator>
		<pubDate>Sun, 28 Sep 2008 07:31:39 +0000</pubDate>
		<guid isPermaLink="false">http://benjchristensen.wordpress.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-260</guid>
		<description><![CDATA[very useful post. Indeed nice analysis.]]></description>
		<content:encoded><![CDATA[<p>very useful post. Indeed nice analysis.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Christensen</title>
		<link>http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-11</link>
		<dc:creator><![CDATA[Ben Christensen]]></dc:creator>
		<pubDate>Fri, 27 Apr 2007 00:02:06 +0000</pubDate>
		<guid isPermaLink="false">http://benjchristensen.wordpress.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-11</guid>
		<description><![CDATA[Hi Christan, 

I&#039;ve added a link to the bottom of the article with the source file. You&#039;ll need to rename it from a .doc ending to .java again ... WordPress won&#039;t allow attaching a .java file.

It&#039;s nothing fancy, but did the job in helping me to validate the memory discrepancies we were seeing in our environments.

Hope it helps in some way.

Ben]]></description>
		<content:encoded><![CDATA[<p>Hi Christan, </p>
<p>I&#8217;ve added a link to the bottom of the article with the source file. You&#8217;ll need to rename it from a .doc ending to .java again &#8230; WordPress won&#8217;t allow attaching a .java file.</p>
<p>It&#8217;s nothing fancy, but did the job in helping me to validate the memory discrepancies we were seeing in our environments.</p>
<p>Hope it helps in some way.</p>
<p>Ben</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian Bourque</title>
		<link>http://benjchristensen.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-10</link>
		<dc:creator><![CDATA[Christian Bourque]]></dc:creator>
		<pubDate>Thu, 26 Apr 2007 14:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://benjchristensen.wordpress.com/2007/02/16/32-bit-versus-64-bit-jdk-memory-usage/#comment-10</guid>
		<description><![CDATA[Hi Ben! 

Very interesting article!

Could you add a link to the Java class you have used for your benchmarks?

I would like to test it on my new server with openSUSE 10.2 (64-bit)... 

Thanks

Christian]]></description>
		<content:encoded><![CDATA[<p>Hi Ben! </p>
<p>Very interesting article!</p>
<p>Could you add a link to the Java class you have used for your benchmarks?</p>
<p>I would like to test it on my new server with openSUSE 10.2 (64-bit)&#8230; </p>
<p>Thanks</p>
<p>Christian</p>
]]></content:encoded>
	</item>
</channel>
</rss>

