由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - 高人点拨一下gc怎么call这个object.finalize()
相关主题
boost intrusive unordered_set erase_and_dispose出错js try catch finally question
请教一个Java编程问题说scala好的进来看看
cassandra async 问题大家在linux下面用什么C++的IDE呢?
js 的typeof基本上是brokeneclipse中总出现这样的错误提示怎么办?
C++ 的 exception handling一个java class downcast 的问题
有一事我一直就是不明白请教template和factory有啥区别?
ytube的一个bug两个看来相似的问题
Java8的lambda很难用呀请问vector
相关话题的讨论汇总
话题: finalize话题: called话题: garbage话题: gc话题: finalizer
进入Programming版参与讨论
1 (共1页)
v****s
发帖数: 1112
1
From Java API doc:
finalize
protected void finalize()
throws Throwable
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object. A subclass
overrides the finalize method to dispose of system resources or to perform
other cleanup.
问题是,这个gc是以何种形式在runtime中出现的?为何这个finalize()要定义成
protected而不是
private? 具体给讲讲?
X****r
发帖数: 3557
2
If you have resource to be disposed of, make an explicit method to
do so. Don't use finalizer. There is no guarantee that when
finalizer is to be called, or even be called at all.

perform

【在 v****s 的大作中提到】
: From Java API doc:
: finalize
: protected void finalize()
: throws Throwable
: Called by the garbage collector on an object when garbage collection
: determines that there are no more references to the object. A subclass
: overrides the finalize method to dispose of system resources or to perform
: other cleanup.
: 问题是,这个gc是以何种形式在runtime中出现的?为何这个finalize()要定义成
: protected而不是

g*****g
发帖数: 34805
3
If you are an average developer, chances are you never ever
need to call finalize

【在 v****s 的大作中提到】
: From Java API doc:
: finalize
: protected void finalize()
: throws Throwable
: Called by the garbage collector on an object when garbage collection
: determines that there are no more references to the object. A subclass
: overrides the finalize method to dispose of system resources or to perform
: other cleanup.
: 问题是,这个gc是以何种形式在runtime中出现的?为何这个finalize()要定义成
: protected而不是

v****s
发帖数: 1112
4
sorry, im asking how JVM is gonna call "object.finalize()", not by my code.
since my java code is not gonna take care of gc.

【在 g*****g 的大作中提到】
: If you are an average developer, chances are you never ever
: need to call finalize

1 (共1页)
进入Programming版参与讨论
相关主题
请问vectorC++ 的 exception handling
准备面试一个java-based position,有什么书推荐一下?有一事我一直就是不明白
Matlab处理数组一问ytube的一个bug
Is "Singleton" design pattern a type of "Factory method" deJava8的lambda很难用呀
boost intrusive unordered_set erase_and_dispose出错js try catch finally question
请教一个Java编程问题说scala好的进来看看
cassandra async 问题大家在linux下面用什么C++的IDE呢?
js 的typeof基本上是brokeneclipse中总出现这样的错误提示怎么办?
相关话题的讨论汇总
话题: finalize话题: called话题: garbage话题: gc话题: finalizer