Java memory leaks - Cleared upon program termination?

余生长醉 提交于 2019-12-20 04:59:19

问题


This seems like a yes or no question, and I would have expected it to be answered somewhere but I certainly can't find it. Memory leaks in java don't happen as often as as say developing in a language like C or C++, but they can happen.

Most OS will clear memory allocated upon a program's termination, with exception to certain cases like shared memory. Is this still true for when the JVM exits? If I inadvertently create a memory leak in Java will it be cleared by either the JVM or a Linux or Windows OS?


回答1:


Yes,all memory will be released after JVM terminated.



来源:https://stackoverflow.com/questions/26770199/java-memory-leaks-cleared-upon-program-termination

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!