Will there be a memory leak in Java, please describe briefly?

Will there be a memory leak in Java, please describe briefly?

In theory, Java has no memory leak problem because of the garbage collection mechanism (GC) (this is also an important reason why Java is widely used in server-side programming);
however, in actual development, there may be useless but reachable objects. These objects cannot be reclaimed by the GC, so memory leaks can also occur. For example, the objects in Hibernate's Session (level one cache) are in a persistent state, and the garbage collector will not reclaim these objects. However, there may be useless garbage objects in these objects. If they are not closed or flushed in time The first level cache may cause memory leaks.

Guess you like

Origin blog.csdn.net/qq_40694640/article/details/112758693