Re: Memory Leaks & Strings
Laura P <firstname.lastname@example.org> wrote:
> I am currently going through a large program trying to root out memory
> leaks. I have found a number of instances where I am converting a
> number to a String by appending an empty String to it i.e.
> double preferredSize = s.readDouble();
> properties.setProperty("preferredWidth", preferredSize+"");
> I am not sure whether memory efficiency could be improved by doing
> this in a different way. In other concatenation instances, I have
> changed to using StringBuffers, alternatively, would any difference be
> made by using preferredSize.toString()?
> If one of these approaches is preferable, how significant would the
> change be to efficiency? I do use the technique above quite a lot...!
Executive summary: I much prefer String.valueOf(preferredSize)
Jon Skeet - <email@example.com>
If replying to the group, please do not mail me too
|All times are GMT. The time now is 09:48 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.