首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何增加Integer对象的缓存大小

如何增加Integer对象的缓存大小
EN

Stack Overflow用户
提问于 2015-05-16 14:53:28
回答 1查看 980关注 0票数 4

读这个question的时候

我知道我们可以通过这个评论来增加缓存的大小。

最近版本的Java 6支持将最大缓存值更改为大于127

我搜索它,但没有发现做同样的事。

请帮帮忙。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-05-16 14:59:31

例如,IntegerCache说:

代码语言:javascript
复制
/**
 * Cache to support the object identity semantics of autoboxing for values between 
 * -128 and 127 (inclusive) as required by JLS.
 *
 * The cache is initialized on first usage. During VM initialization the
 * getAndRemoveCacheProperties method may be used to get and remove any system
 * properites that configure the cache size. At this time, the size of the
 * cache may be controlled by the vm option -XX:AutoBoxCacheMax=<size>.

因此,要么使用VM参数,要么使用以下系统属性:

代码语言:javascript
复制
-Djava.lang.Integer.IntegerCache.high=256

启动JVM时。

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30277106

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档