对于所有的JVM GC实现来说,压缩是不可避免的吗? [英] Is compaction really inevitable for all JVM GC implementations?

查看:121
本文介绍了对于所有的JVM GC实现来说,压缩是不可避免的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此链接上说:


这些暂停是不可避免地要求将
压缩成堆以释放空间的结果。收藏家使用不同的策略来延迟这些事件的
,但对于所有商业
可用收藏家来说,压缩是不可避免的。


我的印象是,如果将应用程序的内存占用量保持不变,则不需要进行GC压缩,换句话说,只有在继续添加和收集对象时才会发生。如果你的堆足够大,并有足够的可用空间,那么当你没有创建任何漏洞(即不产生垃圾)时,为什么要压缩?

I理解为Java应用程序保持持续的内存占用并不容易,但使用正确的分析工具,自举和纪律处理是可能的。

所以不合理假设在不变的内存占用情况下,Java应用程序可以在没有GC引入的延迟的情况下运行,换言之,没有GC暂停? / strong>通过不断的内存占用情况,我的意思是Ajay George提到的稳定状态,当不再创建或取消引用对象时。如果你不断创建对象,你最终会耗尽内存,并且如果你保持解引用对象,你最终会触发GC。因此,最终目标是启动,热身,强制完整GC,然后在生产时间进入稳定状态。 $ b

我的印象是,如果你保持
的内存占用量,你的应用程序不变,那么就不需要对
进行GC压缩,换句话说,只有当你继续添加和
收集对象。

当您的对象被取消引用(符合垃圾收集条件)时,发生压实的范围。
这是因为你开始分割你的堆,就像你的硬盘碎片一样。


所以isn'假设有一个固定的内存空间
a,Java应用程序可以在没有任何GC引入的延迟的情况下运行,换句话说就是
,没有GC暂停?



GC引入的延迟是所使用的GC算法类型的结果。它与具有恒定内存占用空间的概念是正交的。那么,如果你正在考虑你的应用程序没有创建或取消引用对象的情况,并且已经获得了一种稳定状态那么也许。理想情况下,情况并非如此,因为大多数对象都是短暂的。



说到这一点,使用Azul的Pauseless Collection算法,这可能是可能的。
有关此处的精彩讨论。


On this link it is said that:

These pauses are the result of an inevitable requirement to compact the heap to free up space. Collectors use different strategies to delay these events, but compaction is inevitable for all commercial available collectors.

I was under the impression that if you keep the memory footprint of your application constant then there is no need for GC compaction to occur, in other words, it will only happen if you keep adding and collecting objects. If you have a big enough heap with enough free space, why would you ever need to compact when you are not creating any holes (i.e. not generating any trash) ?

I understand that keeping a constant memory footprint for a Java application is not easy, but it is possible with the right profiling tools, bootstrapping and discipline.

So isn't it reasonable to assume that with a constant memory footprint a Java application can run without any GC-introduced latencies, in other words, with no GC pauses?

EDIT: By constant memory footprint I mean a steady state as mentioned by Ajay George, when no more objects are created or de-referenced. If you keep creating objects you will eventually run out of memory and if you keep de-referencing objects you will eventually trigger the GC. So the ultimate goal is to startup, warmup, force a full GC and then enter steady state for production time.

解决方案

I was under the impression that if you keep the memory footprint of your application constant then there is no need for GC compaction to occur, in other words, it will only happen if you keep adding and collecting objects.

The moment your object is getting de-referenced (eligible for Garbage Collection) there is scope for compaction to occur. This is because of the fact that you start fragmenting your heap, much like your hard drive getting fragmented.

So isn't it reasonable to assume that with a constant memory footprint a Java application can run without any GC-introduced latencies, in other words, with no GC pauses?

GC introduced latencies are a result of the type of GC algorithms used. It is orthogonal to concept of having a constant memory footprint. Well, if you are considering the case that your app does not create or de-reference objects and has obtained a sort of steady state then maybe. Ideally this will not be the case, since most of the objects are short-lived.

Having said that, with Azul's Pauseless Collection algorithms, this might be just possible. There is an excellent discussion on that here .

这篇关于对于所有的JVM GC实现来说,压缩是不可避免的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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