The best alternative for String flyweight implementation in Java

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-05-26T18:01:20Z Indexed on 2010/05/26 18:11 UTC
Read the original article Hit count: 238

My application is multithreaded with intensive String processing. We are experiencing excessive memory consumption and profiling has demonstrated that this is due to String data. I think that memory consumption would benefit greatly from using some kind of flyweight pattern implementation or even cache (I know for sure that Strings are often duplicated, although I don't have any hard data in that regard).

I have looked at Java Constant Pool and String.intern, but it seems that it can provoke some PermGen problems.

What would be the best alternative for implementing application-wide, multithreaded pool of Strings in java?

© Stack Overflow or respective owner

Related posts about java

Related posts about string