<?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>Thread stack sizing (why powers of 2?)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114548/thread-stack-sizing-why-powers-of-2</link><description>This is kind of just a general question out of curiosity. 
 Is there a functional reason to ensure that all stack sizes are powers of 2? I&amp;#39;ve seen it throughout many examples and also it was mentioned in DevAcademy, but no reasoning was given. It seems</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 06 Sep 2024 19:25:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114548/thread-stack-sizing-why-powers-of-2" /><item><title>RE: Thread stack sizing (why powers of 2?)</title><link>https://devzone.nordicsemi.com/thread/501595?ContentTypeID=1</link><pubDate>Fri, 06 Sep 2024 19:25:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01f5013b-2fec-4230-b156-2183573dd612</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;MPU only supports power-of-2 region sizes and very few regions, so you need a power-of-2 size when using it for stack protections.&lt;/p&gt;
&lt;p&gt;Otherwise feel free to explore stack size - but keep in mind that stack overflows can be difficult to detect correctly.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve used a 24KB stack for an MP3 decoder thread once - there are no other limits to stack size other than alignment.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>