<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Running Garbage collection Reuses the available flash?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/118000/running-garbage-collection-reuses-the-available-flash</link><description>Hi, 
 We are using nrf52840, with SDK 16.0. we wanted to know that How does Garbage collection works?! 
 Does it reuse the allocated pages by erasing it or it uses the new page? 
 Thank you, 
 Shreya</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Jan 2025 06:01:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/118000/running-garbage-collection-reuses-the-available-flash" /><item><title>RE: Running Garbage collection Reuses the available flash?</title><link>https://devzone.nordicsemi.com/thread/518543?ContentTypeID=1</link><pubDate>Thu, 16 Jan 2025 06:01:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8cefd02-f06f-4f4f-8b1b-2be074479bff</guid><dc:creator>Shreya J B</dc:creator><description>&lt;p&gt;Thank you for the information&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Running Garbage collection Reuses the available flash?</title><link>https://devzone.nordicsemi.com/thread/518158?ContentTypeID=1</link><pubDate>Mon, 13 Jan 2025 13:04:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89864c46-0328-471a-aa0f-c98b2f2ead46</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Shreya,&lt;/p&gt;
[quote user=""]Does it reuse the allocated pages by erasing it or it uses the new page?[/quote]
&lt;p&gt;Both. The FDS garbage collection algorithm works by copying records into erased/pages, and erasing to the old pages so that records are packed efficiently. See the &lt;a href="https://docs.nordicsemi.com/bundle/sdk_nrf5_v17.1.0/page/lib_fds_functionality.html#lib_fds_functionality_gc"&gt;FDS documetnation&lt;/a&gt;. This is doen by the help of the swap page (which moves around) every garbage collection. After gabage collection, all records are typically moved to different addresses, and the swap page has changed place.&amp;nbsp;Dirty records (records marked for re-use becaue they have been deleted or updated), are discarded so that there will be more free spave availble after garbage collection.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>