---
title: "Shubham Kesri (@kesri) | Hashnode"
description: "Shubham Kesri (@kesri) writes on Hashnode. Read their latest articles and follow their work."
url: "https://hashnode.com/@kesri"
---

@kesri

# Shubham Kesri

@kesri · Joined October 2024

## Comments

[Hi Chetan Datta, any updates ?](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f/comment/6715fe86956a891637ec4818#reply-67bf1e2d6e2d865791d06582)

Reply · Article · Feb 26, 2025 · [06 Java - Memory Management and Garbage Collector](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f)

[Hi Chetan Datta, thanks for effort and commitment, I would frame it in this manner, "Firstly, we mark the referenced objects in the Mark phase. followed by shifting/copying of the marked objects to appropriate survivor space and Then, the unmarked objects are removed to free up the memory." For the Mark, Copy & Sweep occurrence sequence, refer - Serial Garbage Collector in https://codecurated.com/blog/understanding-how-java-garbage-collector-works/ Thanks](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f/comment/6715fe86956a891637ec4818#reply-6721209a16b70793e8c0476a)

Reply · Article · Oct 29, 2024 · [06 Java - Memory Management and Garbage Collector](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f)

[https://www.geeksforgeeks.org/mark-and-sweep-garbage-collection-algorithm/ this one clearly states that, "In the Mark phase, we set the marked bit for all the reachable objects (or the objects which a user can refer to) to 1(true)." object that are reachable (i.e., referenced one) are marked and those who are not reachable from how could they be marked ?? In this context, marking mean making sure the object is reachable i.e, still referenced in the program. In the Garbage Collector/Working of Garbage Collector/1st Run of GC/Sweep I think it should be "Keep the marked objects and sweep the rest to the appropriate survivor space". Please share the reference/links you referred to write these, maybe that could help in getting on the same page. Chetan Datta](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f/comment/6715fe86956a891637ec4818#reply-671dd134448513664b1e813a)

Reply · Article · Oct 27, 2024 · [06 Java - Memory Management and Garbage Collector](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f)

[Garbage Collector/Working of Garbage Collector/1st Run of GC Objects o2 and o5 do not have any references. So mark these two. Chetan Datta](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f/comment/6715fe86956a891637ec4818#reply-671dc2af3e4f29a628f38536)

Reply · Article · Oct 27, 2024 · [06 Java - Memory Management and Garbage Collector](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f)

[Please check this:- https://www.geeksforgeeks.org/mark-and-sweep-garbage-collection-algorithm/ Chetan Datta](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f/comment/6715fe86956a891637ec4818#reply-6717ca7bdc832f3a26747bf4)

Reply · Article · Oct 22, 2024 · [06 Java - Memory Management and Garbage Collector](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f)

[In Mark and Sweep, the referenced objects are marked and unreferenced objects are swept from heap. Working of Grabage Collector say otherwise.](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f/comment/6715fe86956a891637ec4818)

Comment · Article · Oct 21, 2024 · [06 Java - Memory Management and Garbage Collector](https://hashnode.com/posts/06-java-memory-management-and-garbage-collector/6619025b7e2645a9e7554e1f)
