<?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>Garbage Collection, Interrupted</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/69965/garbage-collection-interrupted</link><description>nRF52840 
 running nRF5_SDK_15.0.0_a53641a but have also reviewed FDS changes up to nRF5_SDK_17.0.2_d674dde for ideas 
 #define FDS_VIRTUAL_PAGES 5 
 
 I found a scenario where if a Garbage Collection routine is interrupted by device reset such that the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Jan 2021 08:46:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/69965/garbage-collection-interrupted" /><item><title>RE: Garbage Collection, Interrupted</title><link>https://devzone.nordicsemi.com/thread/287867?ContentTypeID=1</link><pubDate>Thu, 07 Jan 2021 08:46:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33825ad6-7355-47c5-85e8-a536c96d1ed8</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Sorry for the delayed response. I was not aware of this particular bug, but I found the exact same fix implemented on our master branch with a similar comment about the problem with reentry (see snippet below). So it seems like your patch must be a valid fix for this bug.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;fds.c on Master&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        case FDS_OP_INIT_PROMOTE_SWAP:
        {
            p_op-&amp;gt;init.step       = FDS_OP_INIT_TAG_SWAP;

            uint16_t const         gc         = m_gc.cur_page;
            uint32_t const * const p_old_swap = m_swap_page.p_addr;

            // Execute the swap.
            m_swap_page.p_addr = m_pages[gc].p_addr;
            m_pages[gc].p_addr = p_old_swap;

            // Copy the offset from the swap to the new page.
            m_pages[gc].write_offset = m_swap_page.write_offset;
            m_swap_page.write_offset = FDS_PAGE_TAG_SIZE;

            m_pages[gc].page_type = FDS_PAGE_DATA;

            // Promote the old swap page to data, but do this at the end
            // because we can re-enter this function; we must update have
            // updated the page in RAM before that.
            ret = page_tag_write_data(p_old_swap);
        } break;
        ...&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>