<?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>nrf_malloc function not able to allocate the memory.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/39176/nrf_malloc-function-not-able-to-allocate-the-memory</link><description>Hi everyone 
 I have been facing some issue while allocating memory using nrf_malloc function on nrf52840. 
 I am giving a size parameter of 8 bytes inside the nrf_malloc function. 
 But the functio n returns me NULL. 
 Also the returned value from nrf_mem_reserve</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 26 Feb 2020 08:19:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/39176/nrf_malloc-function-not-able-to-allocate-the-memory" /><item><title>RE: nrf_malloc function not able to allocate the memory.</title><link>https://devzone.nordicsemi.com/thread/236430?ContentTypeID=1</link><pubDate>Wed, 26 Feb 2020 08:19:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f52436a1-25a0-4a0b-a3b6-929a8c4cae49</guid><dc:creator>lavande</dc:creator><description>&lt;p&gt;Does your program contains softdevice? Can you printf address of the &amp;#39;frame_buffer_black&amp;#39;? Is it starts with 0?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_malloc function not able to allocate the memory.</title><link>https://devzone.nordicsemi.com/thread/151939?ContentTypeID=1</link><pubDate>Mon, 08 Oct 2018 03:46:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fec961a5-eb2a-46eb-9c85-cda6f201d001</guid><dc:creator>Rajat</dc:creator><description>&lt;p&gt;Thanks , It worked.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I changed the max size parameter in sdk_config.h&lt;/p&gt;
&lt;p&gt;And sorry mate , to keep you waiting. I was using SDK 15.0&lt;/p&gt;
&lt;p&gt;Thanks for the Answer&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_malloc function not able to allocate the memory.</title><link>https://devzone.nordicsemi.com/thread/151769?ContentTypeID=1</link><pubDate>Fri, 05 Oct 2018 07:57:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5727d14e-2d4f-480a-bb6c-ad90c9146d33</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Again which SDK version are you using?&lt;/p&gt;
&lt;p&gt;VERIFY_REQUESTED_SIZE(size) macro will return&amp;nbsp;&lt;span&gt;0x8107&amp;nbsp;(NRF_ERROR_INVALID_PARAM | NRF_ERROR_MEMORY_MANAGER_ERR_BASE) if the requested size is larger that the largest block size that is set in the memory manager module.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;#define MAX_MEM_SIZE MEMORY_MANAGER_SMALL_BLOCK_SIZE == 32&lt;/p&gt;
&lt;p&gt;So you must be calling&amp;nbsp;nrf_mem_reserve() with a size larger than 32.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;MEMORY_MANAGER_SMALL_BLOCK_SIZE can be set in sdk_config.h&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_malloc function not able to allocate the memory.</title><link>https://devzone.nordicsemi.com/thread/151748?ContentTypeID=1</link><pubDate>Fri, 05 Oct 2018 04:29:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:257e4f75-1b1c-4cf1-96b9-10736e9d9161</guid><dc:creator>Rajat</dc:creator><description>&lt;p&gt;now it is showing me error 0x8107 which is for invalid parameter , originated from verify requested size inside nrf_mem_reserve function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_malloc function not able to allocate the memory.</title><link>https://devzone.nordicsemi.com/thread/151746?ContentTypeID=1</link><pubDate>Fri, 05 Oct 2018 02:53:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34d0f567-dba6-41f6-b7e7-28e58701f411</guid><dc:creator>Rajat</dc:creator><description>&lt;p&gt;i was not calling nrf_mem_init() function before the nrf_malloc function.&lt;/p&gt;
&lt;p&gt;So the moment i did that , the program just stops at the nrf_malloc function.&lt;/p&gt;
&lt;p&gt;Why is this happenning?&lt;/p&gt;
&lt;p&gt;Same was issue while using malloc() function.&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf_malloc function not able to allocate the memory.</title><link>https://devzone.nordicsemi.com/thread/151661?ContentTypeID=1</link><pubDate>Thu, 04 Oct 2018 12:28:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6b34c21-5238-4e6c-91f8-5ec348caa180</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Which SDK version are you using?&lt;/p&gt;
&lt;p&gt;Looking at the source code of&amp;nbsp;nrf_mem_reserve() in SDK v15.2.0 it seems that it&amp;nbsp; should only return 0x8104 if it fails as the err_code variable is initialized to ( NRF_ERROR_NO_MEM | NRF_ERROR_MEMORY_MANAGER_ERR_BASE) and is only modified to&amp;nbsp;NRF_SUCCESS in&amp;nbsp;nrf_mem_reserve() if it can allocate a large enoug block&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you post the debug log output from the nRF52840?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>