<?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() causing HardFault</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/21338/malloc-causing-hardfault</link><description>Hi, 
 I work on a project for the nRF52832 with Keil &amp;#181;Vision using ARM Compiler V5.06 update 2 and nRF5 SDK 11. 
 In a module I allocate quite some memory using malloc() for signal processing (SP). Upon user request, this mode ends and with that I free</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Aug 2017 13:08:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/21338/malloc-causing-hardfault" /><item><title>RE: malloc() causing HardFault</title><link>https://devzone.nordicsemi.com/thread/83573?ContentTypeID=1</link><pubDate>Mon, 21 Aug 2017 13:08:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7dd74ef0-a3ea-4e5c-a850-469991f5322c</guid><dc:creator>luke</dc:creator><description>&lt;p&gt;i recomend using the nrf_malloc and such memory allocation functions bcz the standard malloc will eventually cause fragmentation like what happened with me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: malloc() causing HardFault</title><link>https://devzone.nordicsemi.com/thread/83572?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2017 14:14:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba483825-11f2-4dc9-83c6-889a8f2f097a</guid><dc:creator>NewtoM</dc:creator><description>&lt;p&gt;No, he didn&amp;#39;t. :)
And I definitely do not believe the &amp;quot;don&amp;#39;t use it anywhere&amp;quot; part.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: malloc() causing HardFault</title><link>https://devzone.nordicsemi.com/thread/83571?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2017 11:31:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f69754f-2eb8-4097-ae2c-5853bfc3c429</guid><dc:creator>endnode</dc:creator><description>&lt;p&gt;(sorry, cannot resist the note: haven&amp;#39;t your teacher also mentioned &amp;quot;don&amp;#39;t use malloc in embedded systems - and possibly don&amp;#39;t use it anywhere&amp;quot;?:)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: malloc() causing HardFault</title><link>https://devzone.nordicsemi.com/thread/83570?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2017 09:59:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6a51460-46a6-4d31-97aa-f4ee8d082849</guid><dc:creator>NewtoM</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;once more I needed to conclude that my old programming teacher was right: &lt;strong&gt;&amp;quot;Computers do not make mistakes; programmers do.&amp;quot;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The cause of the strange behavior of &lt;code&gt;malloc()&lt;/code&gt; was my fault, a logical error in the program. I called &lt;code&gt;free()&lt;/code&gt; twice with the same pointer, which corrupted memory so that the next &lt;code&gt;malloc()&lt;/code&gt; call caused the hard fault.&lt;/p&gt;
&lt;p&gt;Sorry for taking your time.&lt;/p&gt;
&lt;p&gt;Tamas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: malloc() causing HardFault</title><link>https://devzone.nordicsemi.com/thread/83569?ContentTypeID=1</link><pubDate>Thu, 13 Apr 2017 09:50:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ef89dfc-1226-45b1-a47d-e31bba007683</guid><dc:creator>NewtoM</dc:creator><description>&lt;p&gt;OK, I looked in SDK...\components\libraries\hardfault\ and learned a bit.
Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: malloc() causing HardFault</title><link>https://devzone.nordicsemi.com/thread/83568?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 20:51:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b8779e1-08df-4e39-8c74-6f0e93144c5a</guid><dc:creator>NewtoM</dc:creator><description>&lt;p&gt;Can you please point me to some resource on how to do that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: malloc() causing HardFault</title><link>https://devzone.nordicsemi.com/thread/83567?ContentTypeID=1</link><pubDate>Wed, 12 Apr 2017 20:45:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51a9ee73-03c1-4d21-85ee-f5150a85a8b3</guid><dc:creator>WestCoastDaz</dc:creator><description>&lt;p&gt;Have you tired enabling the hardfault handler to see what was executing during the hardfault?&lt;/p&gt;
&lt;p&gt;Cheers,
Darren&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>