我们可以在java中有一个自定义的垃圾收集器吗? [英] Can we have a customized Garbage collector in java?

查看:72
本文介绍了我们可以在java中有一个自定义的垃圾收集器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如我们所知,java的垃圾回收器是一个低优先级的线程。在java中我们可以创建任何高优先级的线程。所以有可能有我们自己定制的垃圾回收器线程具有可变的优先级(我们可以根据内存管理级别来设置)。



有没有人试过。如果是的话,你可以分享一些关于如何和它的逻辑的知识?
谢谢

解决方案

Java的垃圾回收器不是低优先级的线程。例如,垃圾收集通常并行使用多个线程。而且,当内存不足时,垃圾回收可以抢占任何应用程序线程。



我推荐学习垃圾收集调整指南,以确定最适合应用程序的垃圾收集器类型,以及如何调整其参数。


As we know the java's garbage collector is a low priority thread. And in java we can create any thread with high priority. So is it possible to have our own customized garbage collector thread with variable priority (we can set depending on the level of memory management).

Did anybody tried that. If yes can you share some knowledge about how and its logic? Thanks

解决方案

Java's garbage collector isn't "a low priority thread." For example, garbage collection often uses multiple threads in parallel. And, when memory runs low, garbage collection can preempt any application thread.

I recommend studying the Garbage Collection Tuning guide to determine the type of garbage collector best suited to an application, and how to adjust its parameters.

这篇关于我们可以在java中有一个自定义的垃圾收集器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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