JVM -XX:+ StringCache参数? [英] JVM -XX:+StringCache argument?

查看:108
本文介绍了JVM -XX:+ StringCache参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近在阅读JRE 6中提供的所有JVM参数[ Java VM选项]并看到了这个:

I was recently reading about all the JVM arguments available in JRE 6 [Java VM Options] and saw this :


-XX:+ StringCache:启用常用分配字符串的缓存。

-XX:+StringCache : Enables caching of commonly allocated strings.

现在我总是认为Java保留了一个实习池(正确的单词?)字符串,并且在执行类似字符串串联的文章时,它不是创建新对象,但从这个池中拉出它们。有没有人曾经使用过这个论点,或者可以解释为什么需要它?

Now I was always under the impression that Java kept a pool of interned (correct word?) Strings and when doing something like String concatenation with literals it was not creating new objects, but pulling them from this pool. Has anyone ever used this argument, or can explain why it would be needed?

编辑:我试图运行一个基准测试,看看是否这个论点有任何影响,无法让Sun JVM识别它。这是:

I attempted to run a benchmark, to see if this argument had any effect and was unable to get the Sun JVM to recognize it. This was with:

java version "1.6.0_11"  
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode,
sharing)

所以我不确定这个论点是否有效。

So I'm not sure if this argument works at all.

推荐答案

我还没有能够找到一个甚至接受这个假设的JVM的JVM - 所以我想没有别的可说的了。

I have not been able to find a single JVM that even accepts this supposed argument - so I guess there's not much else to say.

这篇关于JVM -XX:+ StringCache参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆