Topic: java中开辟一块内存后如何再关闭? |
Print this page |
1.java中开辟一块内存后如何再关闭? | Copy to clipboard |
Posted by: useforever Posted on: 2007-09-30 13:02 在java中,我new了一个对象(实例化了一个对象),即再内存中分配了一块内存,那么,为了减少内存资源的占用,用什么方法可以在执行完相关代码后关闭这块内存区域呢?? |
2.Re:java中开辟一块内存后如何再关闭? [Re: useforever] | Copy to clipboard |
Posted by: JiafanZhou Posted on: 2007-10-02 15:52 Usually the garbage collection daemon thread will take care of releasing the memory after the object has not been reference. Regards, Jiafan |
3.Re:java中开辟一块内存后如何再关闭? [Re: useforever] | Copy to clipboard |
Posted by: andy_wang_5 Posted on: 2007-10-04 13:28 Java中用new开辟的内存区域不需要回收,对象不再使用的时候(the object has not been reference)会被垃圾回收器回收。垃圾回收器是由jvm自动调用的。也可以自己调用: System.gc(); 如果在java中调用别的语言分配内存(比如c语言的malloc())。是一定要自己释放内存区域的 |
4.Re:java中开辟一块内存后如何再关闭? [Re: useforever] | Copy to clipboard |
Posted by: ranchgirl Posted on: 2007-10-06 07:41 垃圾回收器是由jvm自动调用的。也可以自己调用: System.gc(); This is just a hint, no guarantee to 调用!!!! |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |