为什么我们必须增加Java堆? [英] Why do we have to increase the Java Heap?

查看:129
本文介绍了为什么我们必须增加Java堆?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道如何在Tomcat和Eclipse中设置Java堆大小。我的问题是为什么?在Java首次引入时,是否在初始堆上设置了任意限制,因此VM不会增长到一定的大小?今天大多数机器似乎都有大量可用内存,这不是我们应该处理的事情。

谢谢,
Tom

I know how to set the Java heap size in Tomcat and Eclipse. My question is why? Was there an arbitrary limit set on the initial heap back when Java was first introduced so the VM wouldn't grow over a certain size? It seems with most machines today with large memory space available this isn't something we should have to deal with.
Thanks, Tom

推荐答案

即使是现在,堆也不会无限制地增长。

Even now, the heap doesn't grow without limit.

当最老一代已满时,你应该扩展它吗?还是只是GC?或者,如果GC没有释放任何内存,你应该只扩展它吗?

When the oldest generation is full, should you expand it or just GC? Or should you only expand it if a GC doesn't free any memory?

.NET采用你想要的方法:你不能告诉它只使用它一定数量的堆。有时感觉这是一个更好的主意,但有时候能够在同一台机器上拥有两个进程并且知道它们都不能占用整个内存是很好的...

.NET takes the approach you'd like: you can't tell it to only use a certain amount of heap. Sometimes it feels like that's a better idea, but other times it's nice to be able to have two processes on the same machine and know that neither of them will be able to hog the whole of the memory...

这篇关于为什么我们必须增加Java堆?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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