Hi @Asif Ali ,
If checkpoint exist, checkpoint flushes only the dirty pages, and if SQL Server use the lazy write, it can flush the dirty and clean pages for free space, and can remove the clean pages
Ghost cleanup process deletes records off of pages that have been marked for deletion, the ghost cleanup task cannot physically delete the ghost records until after the delete transaction commits, because the deleted records are locked and the locks are not released until the transaction commits.
When a record is deleted, apart from it being marked as a ghost record, the page that the record is on is also marked as having ghost records in one of the allocation maps
https://www.sqlskills.com/blogs/paul/inside-the-storage-engine-ghost-cleanup-in-depth/
-------------
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.