<?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/"
		>
<channel>
	<title>Comments on: String and memory leaks</title>
	<atom:link href="http://www.javablogging.com/string-and-memory-leaks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.javablogging.com/string-and-memory-leaks/</link>
	<description>Tracking surprises, features and bugs</description>
	<lastBuildDate>Wed, 21 Jul 2010 14:19:17 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: vibram five fingers kso shoes</title>
		<link>http://www.javablogging.com/string-and-memory-leaks/comment-page-1/#comment-3198</link>
		<dc:creator>vibram five fingers kso shoes</dc:creator>
		<pubDate>Sat, 03 Jul 2010 04:11:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.javablogging.com/?p=262#comment-3198</guid>
		<description>Women&#039;s  &lt;a href=&quot;http://www.vibramfivefingers.name&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt;vibram five fingers kso shoes&lt;/strong&gt;&lt;/a&gt; Gray Pink Shoes can keep your feet in the freest condition,just as if your were barefooted. &lt;strong&gt;vibram five fingers kso shoes &lt;/strong&gt;is made of the best and proper materials,so you don&#039;t need to doubt of its comfort with so thin sole and upper.
Gray match with a dreamlike and romantic color,pink&lt;a href=&quot;http://www.vibramfivefingers.name&quot; rel=&quot;nofollow&quot;&gt;&lt;strong&gt; vibram five fingers kso shoes&lt;/strong&gt;&lt;/a&gt; is very consistent with the style of young girls.In this busy and tense times,people need relax without any fetter.</description>
		<content:encoded><![CDATA[<p>Women&#8217;s  <a href="http://www.vibramfivefingers.name" rel="nofollow"><strong>vibram five fingers kso shoes</strong></a> Gray Pink Shoes can keep your feet in the freest condition,just as if your were barefooted. <strong>vibram five fingers kso shoes </strong>is made of the best and proper materials,so you don&#8217;t need to doubt of its comfort with so thin sole and upper.<br />
Gray match with a dreamlike and romantic color,pink<a href="http://www.vibramfivefingers.name" rel="nofollow"><strong> vibram five fingers kso shoes</strong></a> is very consistent with the style of young girls.In this busy and tense times,people need relax without any fetter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.javablogging.com/string-and-memory-leaks/comment-page-1/#comment-871</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 03 Nov 2009 16:32:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.javablogging.com/?p=262#comment-871</guid>
		<description>By saying &quot; your code will invoke getPageTitle() method many times&quot; I meant invocation with different URLs to get different pages. Since URLs are different the page content is also different and there is no sharing of strings between requests. 

Even if you would execute this method with the same parameter 1000 times, since the content is downloaded from the web you probably would get different string objects that would have the same content, but did not share an char array (unless getPageContent(pageUrl) implements some caching mechanism or interns the results).</description>
		<content:encoded><![CDATA[<p>By saying &#8221; your code will invoke getPageTitle() method many times&#8221; I meant invocation with different URLs to get different pages. Since URLs are different the page content is also different and there is no sharing of strings between requests. </p>
<p>Even if you would execute this method with the same parameter 1000 times, since the content is downloaded from the web you probably would get different string objects that would have the same content, but did not share an char array (unless getPageContent(pageUrl) implements some caching mechanism or interns the results).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: z</title>
		<link>http://www.javablogging.com/string-and-memory-leaks/comment-page-1/#comment-869</link>
		<dc:creator>z</dc:creator>
		<pubDate>Tue, 03 Nov 2009 16:13:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.javablogging.com/?p=262#comment-869</guid>
		<description>
If your code will invoke getPageTitle() method many times you may find out that you have stored only a thousand titles and already you are out of memory!! Scary, right?


not really. as u mentioned u have only one 100k char array, so if u run out of memory that&#039;s not bckz u invoked 1000 times getPageTitle().
once u have 1 String pointing at the title u already have a live reference, so there should not be a big difference 1 or 1000 references.</description>
		<content:encoded><![CDATA[<p>If your code will invoke getPageTitle() method many times you may find out that you have stored only a thousand titles and already you are out of memory!! Scary, right?</p>
<p>not really. as u mentioned u have only one 100k char array, so if u run out of memory that&#8217;s not bckz u invoked 1000 times getPageTitle().<br />
once u have 1 String pointing at the title u already have a live reference, so there should not be a big difference 1 or 1000 references.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: z</title>
		<link>http://www.javablogging.com/string-and-memory-leaks/comment-page-1/#comment-868</link>
		<dc:creator>z</dc:creator>
		<pubDate>Tue, 03 Nov 2009 16:08:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.javablogging.com/?p=262#comment-868</guid>
		<description>&gt;pls help me understand if String object is &gt;garbage collected?
&gt;As far as I know String is stored in a pool &gt;.therefore once created it cannot be garbage &gt;collected?

if u define a variable like:
String z = &quot;aaa&quot;; // this value will be taken from String&#039;s pool.
String z = new String(&quot;aaa&quot;); // here a new string object with value &quot;aaa&quot; will be created regardless of what u have in ur pool.

ps: afaik some of values from String&#039;s global pool, will be GC-ed at some point.. but this is not smth u should care about.</description>
		<content:encoded><![CDATA[<p>&gt;pls help me understand if String object is &gt;garbage collected?<br />
&gt;As far as I know String is stored in a pool &gt;.therefore once created it cannot be garbage &gt;collected?</p>
<p>if u define a variable like:<br />
String z = &#8220;aaa&#8221;; // this value will be taken from String&#8217;s pool.<br />
String z = new String(&#8221;aaa&#8221;); // here a new string object with value &#8220;aaa&#8221; will be created regardless of what u have in ur pool.</p>
<p>ps: afaik some of values from String&#8217;s global pool, will be GC-ed at some point.. but this is not smth u should care about.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: A.Clark</title>
		<link>http://www.javablogging.com/string-and-memory-leaks/comment-page-1/#comment-556</link>
		<dc:creator>A.Clark</dc:creator>
		<pubDate>Wed, 07 Oct 2009 10:14:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.javablogging.com/?p=262#comment-556</guid>
		<description>Awesome ! Really appreicate your job !</description>
		<content:encoded><![CDATA[<p>Awesome ! Really appreicate your job !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amit</title>
		<link>http://www.javablogging.com/string-and-memory-leaks/comment-page-1/#comment-368</link>
		<dc:creator>Amit</dc:creator>
		<pubDate>Fri, 11 Sep 2009 17:31:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.javablogging.com/?p=262#comment-368</guid>
		<description>A very good article.</description>
		<content:encoded><![CDATA[<p>A very good article.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Twitter Trackbacks for JavaBlogging » String and memory leaks [javablogging.com] on Topsy.com</title>
		<link>http://www.javablogging.com/string-and-memory-leaks/comment-page-1/#comment-266</link>
		<dc:creator>Twitter Trackbacks for JavaBlogging » String and memory leaks [javablogging.com] on Topsy.com</dc:creator>
		<pubDate>Fri, 28 Aug 2009 16:57:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.javablogging.com/?p=262#comment-266</guid>
		<description>[...] link is being shared on Twitter right now. @shauryashaurya said I love the tag line here: [...]</description>
		<content:encoded><![CDATA[<p>[...] link is being shared on Twitter right now. @shauryashaurya said I love the tag line here: [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shailendra</title>
		<link>http://www.javablogging.com/string-and-memory-leaks/comment-page-1/#comment-71</link>
		<dc:creator>Shailendra</dc:creator>
		<pubDate>Thu, 30 Jul 2009 13:11:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.javablogging.com/?p=262#comment-71</guid>
		<description>pls help me understand if String object is garbage collected?
As far as I know String is stored in a pool .therefore once created it cannot be garbage collected?</description>
		<content:encoded><![CDATA[<p>pls help me understand if String object is garbage collected?<br />
As far as I know String is stored in a pool .therefore once created it cannot be garbage collected?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Jordan</title>
		<link>http://www.javablogging.com/string-and-memory-leaks/comment-page-1/#comment-70</link>
		<dc:creator>Kevin Jordan</dc:creator>
		<pubDate>Wed, 29 Jul 2009 13:58:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.javablogging.com/?p=262#comment-70</guid>
		<description>I&#039;d probably use StringBuffer if I knew a String was going to be more than 1000 characters long.  In fact, that&#039;s probably the way to go for substring anyways if you don&#039;t care about the original string being cached.</description>
		<content:encoded><![CDATA[<p>I&#8217;d probably use StringBuffer if I knew a String was going to be more than 1000 characters long.  In fact, that&#8217;s probably the way to go for substring anyways if you don&#8217;t care about the original string being cached.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Morris</title>
		<link>http://www.javablogging.com/string-and-memory-leaks/comment-page-1/#comment-69</link>
		<dc:creator>Tony Morris</dc:creator>
		<pubDate>Wed, 29 Jul 2009 09:30:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.javablogging.com/?p=262#comment-69</guid>
		<description>Java does so many things wrong, including java.lang.String. The issue here is the forced evaluation of the data structure. The forced evaluation is required since Java is a forcefully imperative language with no flexibility.

Functional Java has a lazy list (fj.data.Stream) data structure that will solve your problem. Take a look at the drop/take methods some time.

Better still, upgrade the language to a more practical one.</description>
		<content:encoded><![CDATA[<p>Java does so many things wrong, including java.lang.String. The issue here is the forced evaluation of the data structure. The forced evaluation is required since Java is a forcefully imperative language with no flexibility.</p>
<p>Functional Java has a lazy list (fj.data.Stream) data structure that will solve your problem. Take a look at the drop/take methods some time.</p>
<p>Better still, upgrade the language to a more practical one.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
