<?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/"
	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>Ismael Juma &#187; garbage collection</title>
	<atom:link href="http://blog.juma.me.uk/tag/garbage-collection/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.juma.me.uk</link>
	<description></description>
	<lastBuildDate>Fri, 18 Nov 2011 00:09:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.juma.me.uk' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ismael Juma &#187; garbage collection</title>
		<link>http://blog.juma.me.uk</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.juma.me.uk/osd.xml" title="Ismael Juma" />
	<atom:link rel='hub' href='http://blog.juma.me.uk/?pushpress=hub'/>
		<item>
		<title>Local variables scope in HotSpot</title>
		<link>http://blog.juma.me.uk/2008/10/11/local-variables-scope-in-hotspot/</link>
		<comments>http://blog.juma.me.uk/2008/10/11/local-variables-scope-in-hotspot/#comments</comments>
		<pubDate>Sat, 11 Oct 2008 06:16:26 +0000</pubDate>
		<dc:creator>Ismael Juma</dc:creator>
				<category><![CDATA[jvm]]></category>
		<category><![CDATA[garbage collection]]></category>
		<category><![CDATA[hotspot]]></category>
		<category><![CDATA[jit]]></category>

		<guid isPermaLink="false">http://ijuma.wordpress.com/?p=30</guid>
		<description><![CDATA[Assume the following code: I was under the impression that HotSpot would not garbage collect c before the local variable went out of scope although it is legally allowed to do so. I even heard of issues where unnecessary garbage was retained as a result (usual workarounds are to null the variable or to inline [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.juma.me.uk&amp;blog=4860094&amp;post=30&amp;subd=ijuma&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Assume the following code:</p>
<p><pre class="brush: java;">
  public void foo() {
    C c = new C();
    bar(c.baz); // assume that baz does not reference c
  }
</pre></p>
<p>I was under the impression that HotSpot would not garbage collect c before the local variable went out of scope although it is legally allowed to do so. I even heard of issues where unnecessary garbage was retained as a result (usual workarounds are to null the variable or to inline it).</p>
<p>According to this <a href="http://bugs.sun.com/view_bug.do?bug_id=6721588">bug report</a> (Server JIT optimization can cause objects to go out of scope prematurely), the Server VM is actually able to GC the object before the local variable goes out of scope. It would be interesting to know if it can detect such cases reliably.</p>
<br />Posted in jvm Tagged: garbage collection, hotspot, jit, jvm <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ijuma.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ijuma.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ijuma.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ijuma.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ijuma.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ijuma.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ijuma.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ijuma.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ijuma.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ijuma.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ijuma.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ijuma.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ijuma.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ijuma.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.juma.me.uk&amp;blog=4860094&amp;post=30&amp;subd=ijuma&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.juma.me.uk/2008/10/11/local-variables-scope-in-hotspot/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0eb053bf15b0a3669c973bc50be45a7c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ijuma</media:title>
		</media:content>
	</item>
	</channel>
</rss>
