Java的垃圾回收 [英] Java Garbage Collection

查看:130
本文介绍了Java的垃圾回收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道的垃圾收集,发生在爪哇。是不是真的能够处理未使用的所有对象,并释放出最可能的内存?

I was wondering about the garbage collection that takes place in Java. Is it really able to handle all objects that aren't used and free up the most possible memory?

我也想知道如何在Java垃圾收集的数据进行比较如语言可以说C#?然后,是如何从如C语言并自动垃圾收集措施对抗手工收集?

I also want to know how does the Java garbage collection compare to another language like lets say C#? And then, how does the automatic garbage collection measure up against manual collection from a language like C?

推荐答案

是的,那点垃圾收集。

Yes, thats the point of garbage collection.

有许多不同形式的垃圾收集。最简单的形式,引用计数,无法处理某些类型的垃圾(循环引用),而不增强算法的。

There are many different forms of garbage collection. The simplest form, reference counting, is not able to handle certain type of garbage (circular references) without enhancements to the algorithm.

Java的(太阳JVM)使用代标记和清除收集器,虽然这是不规范的和不同的JVM都使用不同的收藏家。我不知道在.NET CLR使用的确切收集器。

Java (the Sun JVM) uses a generational mark and sweep collector, though this is not standardized and different JVMs do use different collectors. I do not know the exact collector used by the .NET CLR.

垃圾收集像减少程序员的开销,并且可以使一定的算法有更好的表现。然而,它们的内存占用一般比一紧手动分配制度更大

Garbage collectors like reduce programmer overhead, and can make certain algorithms perform better. However, their memory footprint is generally larger than a tight manual allocation system.

有关这个主题的事实上的引用是的本书垃圾收集,这是写得很好的,全面的。

The defacto reference on this topic is the book Garbage Collection, which is well written and comprehensive.

这篇关于Java的垃圾回收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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