<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Innovation On The Run &#187; java memory</title>
	<atom:link href="http://www.innovationontherun.com/tag/java-memory/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.innovationontherun.com</link>
	<description>Ruminations about innovation and software by Rob Di Marco</description>
	<lastBuildDate>Fri, 27 Jan 2012 12:15:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Java Memory Management Improvement Proposal</title>
		<link>http://www.innovationontherun.com/java-memory-management-improvement-proposal/</link>
		<comments>http://www.innovationontherun.com/java-memory-management-improvement-proposal/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 12:25:45 +0000</pubDate>
		<dc:creator>Rob Di Marco</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[java memory]]></category>

		<guid isPermaLink="false">http://www.innovationontherun.com/?p=71</guid>
		<description><![CDATA[For the umpteenth time, I had to deal with the dreaded Java OutOfMemoryError, this time when trying to run Fisheye Subversion browser.&#160; My problem deals with a known issue in Fisheye where a background indexing task sometimes runs causes an OOM error.&#160; Of course, an OOM does not just effect the indexing task, it can [...]]]></description>
			<content:encoded><![CDATA[<p>For the umpteenth time, I had to deal with the dreaded Java <a href="http://java.sun.com/javase/6/docs/api/java/lang/OutOfMemoryError.html">OutOfMemoryError</a>, this time when trying to run <a href="https://www.atlassian.com/software/fisheye/">Fisheye</a> Subversion browser.&nbsp; My problem deals with a <a href="http://jira.atlassian.com/browse/FE-624">known issue</a> in Fisheye where a background indexing task sometimes runs causes an OOM error.&nbsp; Of course, an OOM does not just effect the indexing task, it can also impact other operations unrelated to the task with the memory leak.&nbsp; While diagnosing this problem, it got me thinking about how this could be better managed.</p>
<h2>The Problem</h2>
<p>&nbsp;The JVM defines a single heap for all objects created across all threads in the java process.&nbsp; A consequence of this is that if one processing thread has a memory leak, any thread on the JVM may start suffering from OOM errors.&nbsp; However, not all threads are equally important to my application.&nbsp; I may not mind too much if a batch processing thread fails with an OOM but I may care very much if the lack of memory causes all of my Tomcat threads to no longer be able to process web requests.</p>
<h2>Proposed Solution</h2>
<p>What I would like is to be able to segment my heap so that I can dedicate portions of the heap (either by percentage of the total heap or by absolute number of bytes) to a specific set of work.&nbsp; That way if an OOM occurs, I can contain its impact to a certain set of threads while other threads continue processing.&nbsp; I would see this being configured as JVM runtime -X arguments, something like <span class="Code">-XHeapSegment:Name=MyMemHeap,Size=25%,Thread=&lt;ThreadNameRegex&gt;</span></p>
<p>I could see the partitioning being relative (by percentage) or absolute (total bytes allocated).&nbsp; I could also see linking it to ThreadGroups as opposed to just Threads.</p>
<h2>Some Questions</h2>
<ul>
<li>Do others see value in this proposal?</li>
<li>I am not an expert at JVM internals.&nbsp; Is there a fundamental reason this would not work?</li>
<li>Any other suggestions?</li>
<li>Should we allow this segmentation to be defined at compile-time as well through annotations?</li>
</ul>
<h2>Notes</h2>
<ul>
<li>For the purposes of the problem I defined, I do not have a requirement that the young generations also be segmented.&nbsp; However, if it is impractical to keep a single set of young generations and segmented older generations, I can deal with having segmentation in the young generations as well.</li>
<li>Obviously, this would in no way address all OutOfMemoryErrors.&nbsp; We can still look forward to running out of PermGenSpace</li>
</ul>
<img src="http://www.innovationontherun.com/?ak_action=api_record_view&id=71&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.innovationontherun.com/java-memory-management-improvement-proposal/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

