Java garbage collector logic

As you know, the garbage collector is a thread in java. And each thread will have its own logic to execute. So I wanted to know what logic this garbage collector uses, which saves memory so well.

thank

+1
source share
4 answers

An object is considered garbage when it can no longer be reached from any pointer in a running program. The simplest garbage collection algorithms simply iterate over every available object. Any remaining objects are then considered garbage. The time spent on this approach is proportional to the number of live objects, which is prohibitive for large applications that support a lot of live data.

5.0 Java [tm]

+1

. Mark-and-Sweep. .

EDIT: , .

0

COM - . .NET . .

: , , , . .

: .NET , .

:

: 1. 2.

, , .

  • .
  • , , .
  • .
  • .

GC : , . GC ], .

GC , "". , GC , ( VB.NET) , . , GC , .

: DEAD

, , , , .

0

JVM , . , , .

To see the garbage collector start to work, add the -verbose: gc command line argument to your virtual machine.

A detailed article about the garbage collector can be found here: Configuring the garbage collection with the Java Virtual Machine 5.0

0
source

Source: https://habr.com/ru/post/1788107/


All Articles