Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java GC name 'MarkSweepCompact'

Tags:

java

what is MarkSweepCompact ?


1 Answers

It's a garbage collection algorithm. It's basic workings are described in Wikipedia.

The basic idea is that you perform one "marking" pass over all your objects you can access, marking them. Then you "sweep" over your heap, freeing the memory of those objects that can't be reached anymore (which are not marked). The "compact" pass then compacts memory again since you now have multiple unused holes in it which can make allocation of new objects more difficult or expensive.

like image 126
Joey Avatar answered Jun 02 '26 09:06

Joey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!