+2 votes
in JAVA by
Is it correct to say that due to garbage collection feature in Java, a java program never goes out of memory in Java?

1 Answer

0 votes
by
Even though automatic garbage collection is provided by Java, it doesn’t ensure that a Java program will not go out of memory as there is a possibility that creation of Java objects is being done at a faster pace compared to garbage collection resulting in filling of all the available memory resources.

So, garbage collection helps in reducing the chances of a program going out of memory but it doesn’t ensure that.

Related questions

0 votes
asked Jul 3, 2023 in JAVA by Robin
+1 vote
asked Jan 24, 2020 in JAVA by rahuljain1
...