commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <>
Subject Re: [lang] CharSet oversight?
Date Sat, 02 Aug 2003 20:51:44 GMT
I disagree that GC is an issue with a cached toString. The String reference
will only be held by our class so would not block a GC run.

You are probably right that the cost isn't justified here. I'll have to
check the rest of lang to see what it does. I think that some other classes
also cache the toString.


----- Original Message -----
From: "Chris Feldhacker" <>
> Please consider the following patch.  Suggested changes included:
> 1) Made "serialVersionUID" private instead of default scope (same should
> done in CharSet)
> 2)  I question the need to cache the toString representation: is this
> necessary?  If so, then why not do it elsewhere?  I think that by caching
> the toString value we could be preventing garbage collection of a cached
> value that is no longer needed simply because our class continues to hang
> to it.  Besides, the toString method is extremely quick; perhaps if it was
> more complex and intensive...  (even then, I would think the cached value
> should be stored in a SoftReference to make sure garbage collection can
> occur).
> Thoughts?
> ----- Original Message -----
> From: "Stephen Colebourne"
> To: "Jakarta Commons Developers List"
> Sent: Saturday, August 02, 2003 1:30 PM
> Subject: Re: [lang] CharSet oversight?
> > CharSet and CharRange now fully rewritten, javadocced and tested. Be
> > if you had a quick look....
> >
> > Stephen


> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message