JAngara
JAngara

Reputation: 13

Mark-and-Sweep algorithm JAVA

What does it mean when Mark-and-Sweep algorithm has a disadvantage of "stop the world"? What does the world refer to? and why does it stop the world?

Upvotes: 1

Views: 577

Answers (1)

meJustAndrew
meJustAndrew

Reputation: 6613

A simple google search about this agorithm brought this as first site (at least for me)

The main disadvantage of the mark-and-sweep approach is the fact that that normal program execution is suspended while the garbage collection algorithm runs. In particular, this can be a problem in a program that interacts with a human user or that must satisfy real-time execution constraints. For example, an interactive application that uses mark-and-sweep garbage collection becomes unresponsive periodically.

So basically your program will just freeze during memory deallocation.

Upvotes: 1

Related Questions