由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - Java都在什么时候进行Garbage collection?
相关主题
Java/J2EE的面试中,关于garbage collection的问题应该怎么回答?apply Java board BF
GC finalize()一问java source code analyzing tool
c++熟手如何学习Java直到能够参与开发企业级应用?两个很基本的JAVA问题
garbage collection issueAnyone took Java Architect cert test?
JDK Source?大家能推荐考JAVA证书的中文网站吗?
Extracting JavaDoc comment?问个知识升级的问题
An experiment with JVM Garbage Collection SchemesAnother garbage collection question
Re: Want to take Java Certification考完SCJP后大家建议下一个考什么比较好?
相关话题的讨论汇总
话题: gc话题: java话题: garbage话题: jvm话题: collection
进入Java版参与讨论
1 (共1页)
t****o
发帖数: 181
1
只在new一个object或者array的时候才有可能产生Garbage collection吗?还有没
有可能在其他情况下触发
f********h
发帖数: 149
2
of course it could. GC is running at a separate thread.

【在 t****o 的大作中提到】
: 只在new一个object或者array的时候才有可能产生Garbage collection吗?还有没
: 有可能在其他情况下触发

t****o
发帖数: 181
3
譬如还有什么能够触发Garbage collection?
不是抬杠,实在是想知道。。。

【在 f********h 的大作中提到】
: of course it could. GC is running at a separate thread.
f********h
发帖数: 149
4
jvm will decide when to use GC,and you
can also call GC explicitly.
check javadoc of GC

【在 t****o 的大作中提到】
: 譬如还有什么能够触发Garbage collection?
: 不是抬杠,实在是想知道。。。

m*m
发帖数: 47
5
java执行GC是不确定的, 除非force GC.

【在 t****o 的大作中提到】
: 只在new一个object或者array的时候才有可能产生Garbage collection吗?还有没
: 有可能在其他情况下触发

c*z
发帖数: 62
6
Thers is no way to force GC to run, right?
I believe the GC is called when JVM is running out of memory.

【在 m*m 的大作中提到】
: java执行GC是不确定的, 除非force GC.
z****g
发帖数: 2497
7
You can't force GC.

【在 m*m 的大作中提到】
: java执行GC是不确定的, 除非force GC.
o**v
发帖数: 1662
8
System.gc();

【在 z****g 的大作中提到】
: You can't force GC.
z****g
发帖数: 2497
9
This only suggest garbage collect to run, not really forcing it.
read your java book.

【在 o**v 的大作中提到】
: System.gc();
o**v
发帖数: 1662
10
gc
public static void gc()Runs the garbage collector.
Calling the gc method suggests that the Java Virtual Machine expend
effort toward recycling unused objects in order to make the memory
they currently occupy available for quick reuse. When control returns
from the method call, the Java Virtual Machine has made a best effort to
reclaim space from all discarded objects.
The call System.gc() is effectively equivalent to the call:
Runtime.getRuntime().gc()
See Also:
Runtime.gc()

【在 z****g 的大作中提到】
: This only suggest garbage collect to run, not really forcing it.
: read your java book.

z***e
发帖数: 5393
11
no, even if you call GC explicitly, there is no guarantee JVM will do it
immediately.
a typical question for scjp test.

【在 f********h 的大作中提到】
: jvm will decide when to use GC,and you
: can also call GC explicitly.
: check javadoc of GC

g*****g
发帖数: 34805
12
What actually implemented in background is that once you call
GC, the priority of GC thread increases. There is no promise
highest priority thread will be executed immediately, as they
might be equal peers.

【在 z***e 的大作中提到】
: no, even if you call GC explicitly, there is no guarantee JVM will do it
: immediately.
: a typical question for scjp test.

c**g
发帖数: 274
13
about java GC, you can suggest, but can't demand. JVM has the final
say about when to do it.

【在 t****o 的大作中提到】
: 只在new一个object或者array的时候才有可能产生Garbage collection吗?还有没
: 有可能在其他情况下触发

1 (共1页)
进入Java版参与讨论
相关主题
考完SCJP后大家建议下一个考什么比较好?JDK Source?
考一个sun certified programmer 310-035 大约需要多久?Extracting JavaDoc comment?
java为啥这么多frameworkAn experiment with JVM Garbage Collection Schemes
如何生产产生Java Doc的注释Re: Want to take Java Certification
Java/J2EE的面试中,关于garbage collection的问题应该怎么回答?apply Java board BF
GC finalize()一问java source code analyzing tool
c++熟手如何学习Java直到能够参与开发企业级应用?两个很基本的JAVA问题
garbage collection issueAnyone took Java Architect cert test?
相关话题的讨论汇总
话题: gc话题: java话题: garbage话题: jvm话题: collection