Sobes.tech
Junior — Middle

How can the automatic memory management mechanism be activated in the system?

sobes.tech AI

Answer from AI

In Java, the automatic memory management mechanism is implemented through the garbage collector (GC). To activate it, simply run the program on the JVM — the garbage collector is enabled by default and works automatically.

If you need to control the behavior of the GC, you can use JVM parameters, for example:

java -XX:+UseG1GC MyApp

where -XX:+UseG1GC activates the G1 collector. However, the mechanism itself does not require additional activation — it is built-in and operates constantly, freeing memory from unused objects.

How can the automatic memory management mechanism be… - sobes.tech