« Return to Thread: Java integration: Swing string problem

Re: Java integration: Swing string problem

by Hugh Winkler :: Rate this Message:

Reply to Author | View in Thread

On Jan 6, 2008 9:45 AM, Marcin Mielżyński <lopx@...> wrote:

> Hugh Winkler pisze:
>
> > On Jan 6, 2008 9:02 AM, Marcin Mielżyński <lopx@...> wrote:
> >
> >
> >> Interning arbitrary strings is evil, we should avoid this as much as
> >> possible.
> >>
> >>
> >
> > What is your reason?
> >
> Interned Strings are not GCable, this leads to permgen issues (JRuby has
> big permgen footprint already).
>
>


Oh. Well that is a very good reason.

1. It could be a runtime switch to jruby :
-Djruby.intern.java.string=true. (along with -XX:MaxPermGen=...) Then
the developer takes responsibility.

2. Jruby might apply intern only to "public static final" strings that
originated with a java import, because that is the real use case. It
would have to set a flag that travels around with the RubyString
somehow, to remember to intern the string when needed.

3. I tried to find a way to call intern from JRuby, but I ended up
with Ruby strings. My jruby java integration knowledge isn't great,
and I suspect there might be a way to do that. I'm not sure how much
an improvement that would be over my workaround, though. It's still
going to be a surprise for anyone developing a Swing app, some APIs
they will have to learn to treat specially.

Hugh


> Marcin.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

 « Return to Thread: Java integration: Swing string problem