On 9/25/2010 8:53 PM, smallufo wrote:
I am using a profiler to analyze an OOM heap-dump file , and find tons of
duplicated Strings .
These strings are mostly IDs of wicket components or PropertyModel's
expression ...
I wonder if it a good practice to "intern()" all these Strings ?

such as :

private final static String TIME_STR = "time".intern();
add(new Label(TIME_STR , foobar));


I wouldn't do that. You'll most likely run into performance issues. Duplicate strings should only arise with the use of new String(). Explicitly calling intern() could cause an unexpected amount of memory usage in PermGen.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to