<?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>malloc() returns valid pointer even if heap size is set to 0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43044/malloc-returns-valid-pointer-even-if-heap-size-is-set-to-0</link><description>Hello. I need a bit of help with my case. I have nRF52832 dev kit. I have set heap size to zero in Makefile: 
 
 And even with that change I am still able to allocate memory using malloc(). Here is the code: 
 
 And this is the result: 
 
 So malloc(</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 27 Jan 2019 16:43:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43044/malloc-returns-valid-pointer-even-if-heap-size-is-set-to-0" /><item><title>RE: malloc() returns valid pointer even if heap size is set to 0</title><link>https://devzone.nordicsemi.com/thread/168099?ContentTypeID=1</link><pubDate>Sun, 27 Jan 2019 16:43:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:745538d5-da09-4256-95e4-ef62917bb6ce</guid><dc:creator>era</dc:creator><description>&lt;p&gt;Do you mean that newlib&amp;#39;s malloc implementation has such obvious bug? It&amp;#39;s hard to believe that it allows to allocate more memory than exists on the device.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: malloc() returns valid pointer even if heap size is set to 0</title><link>https://devzone.nordicsemi.com/thread/168074?ContentTypeID=1</link><pubDate>Sun, 27 Jan 2019 01:10:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66b5a47d-55f9-4099-b8de-a702e987a8be</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;It&amp;#39;s not allocating memory, it&amp;#39;s a bug in the malloc implementation which is a very simple malloc. You can look at the source code and see this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>