把b和c的实例设为null然后 system.gc();
解决方案 »
- 在线等!重命名文件夹的问题
- bmo 和 dao 是什么?
- java控件 类QQ控件 有没有知道是什么空间的啊
- java如何遍历hashmap
- 关于file类的问题!
- 哪位大侠做过C/S模式的上传与下载application?提供祥细思路也行啊。(我是菜鸟)
- 那位大侠知道java编程指南(1.4)的电子书籍下载地址啊??????
- 关于java读取excel
- 谁有类似bugbase的工具,用于公司内部开发测试的交流协调。
- fatjar安装包
- 怪事.....求助各位高手?
- 求Rational.XDE.Developer.Plus.for.Java.V2003.6.12.ISO-RiSE.ShareReactor.bin
---------------------------------
Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. That is, the resources for these Components will be destroyed, any memory they consume will be returned to the OS, and they will be ed as undisplayable. The Window and its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call to pack or show. The states of the recreated Window and its subcomponents will be identical to the states of these objects at the point where the Window was disposed (not accounting for additional modifications between those actions).
-------------------------------------
它释放的资源不完全,例如线程,端口,COM 口 等这些资源它都无法释放!我现在主要是已经有写好的几个程序!他们单独运行都是可以的!
现在我要做一个类似“菜单”的程序把他们关联起来!并可以互相切换,所以必须当关闭其中一个程序的时候释放他所占用的资源!!
我认为JVM提供的内存回收机制因该就能满足一般的需求吧
不然这个东西只能给Java带来骂名~~~~~
它释放的资源不完全,例如线程,端口,COM 口 等这些资源它都无法释放!
-------------------------------------------------------------------------去!
JAVA的垃圾回收机制是带点随机的,,,你只能用system.gc()来“建议”它做垃圾收集,
至于它想什么时候收集,收集什么,这不是你能定置的!当不再有任何一个其它的对象对某对象A的引用时,A就会被列到“黑名单”里,随时恭候被回收。你最好再仔细查查是不是哪里还隐含了什么对象对某对象B的引用,导致B不能被回收。
随便,如果你是用runtime.exec什么的来启动进程的,还可以用此函数的返回值process来kiil线程。