<?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>Memory allocation</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110699/memory-allocation</link><description>Hi 
 I&amp;#39;m trying to figure out how to manage my memory on the nrf9160 sip. Currently my application crashes on a specific lines where I try to allocate a large C++ string (the crash happens at around a string size of 10 kB see call stack below). 
 
 I</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 10 Jun 2024 11:55:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110699/memory-allocation" /><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/488117?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2024 11:55:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:503504c4-63c1-4f47-9f52-031f0faa1ced</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;You need to modify the pm_static.yml file to change the partition layout in multi image builds, as far as I know.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/488038?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2024 08:06:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02599385-7c61-4f69-9b17-ab3ca1ff1425</guid><dc:creator>NilsDR</dc:creator><description>&lt;p&gt;I am building with TFM as I&amp;#39;m using the _ns version and I think it&amp;#39;s necessary as I&amp;#39;m using modules that require TFM. Maybe I can change the devicetree to increase the allocated ram? This is my current devicetree:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;pre class="ui-code" data-mode="text"&gt;/ {

	reserved-memory {
		#address-cells = &amp;lt;1&amp;gt;;
		#size-cells = &amp;lt;1&amp;gt;;
		ranges;

		sram0_s: image_s@20000000 {
			/* Secure image memory */
		};

		sram0_modem: image_modem@20016000 {
			/* Modem (shared) memory */
		};

		sram0_ns: image_ns@20020000 {
			/* Non-Secure image memory */
		};
	};
};&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/487671?ContentTypeID=1</link><pubDate>Thu, 06 Jun 2024 09:16:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eba9682-99e8-4fa7-afea-c8c74f5fe24c</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Are you building with TFM? Have you tried building without TFM?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/485816?ContentTypeID=1</link><pubDate>Fri, 24 May 2024 12:29:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:65a2fb11-d20a-45ba-a3ce-f79f7a6b9723</guid><dc:creator>NilsDR</dc:creator><description>&lt;p&gt;I basically just want to increase the amount of RAM that std::string can allocate&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/483193?ContentTypeID=1</link><pubDate>Tue, 14 May 2024 09:00:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d77db68-1787-42c0-960a-38e7bfb63afc</guid><dc:creator>NilsDR</dc:creator><description>&lt;p&gt;Okay, so since i&amp;#39;m not setting the&amp;nbsp;&lt;span&gt;CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE it must be -1 and then I already have the maximum amount of space for std::string? Im just curious to why i&amp;#39;m only able to allocate ~5000 bytes when the nrf9160 have 256kb ram. I must allocate the ram to something else?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This is my current prj.conf&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Cpp
CONFIG_CPP=y
CONFIG_STD_CPP20=y
CONFIG_MINIMAL_LIBCPP=n
CONFIG_CPP_MAIN=y
CONFIG_GLIBCXX_LIBCPP=y
CONFIG_CPP_EXCEPTIONS=y

# Peripherals
CONFIG_I2C=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_PWM=y

# NEWLIB C
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

# Network
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_NETWORK_MODE_LTE_M=y

# Modem library
CONFIG_NRF_MODEM_LIB=y

# AT Host
CONFIG_AT_HOST_LIBRARY=y

# Azure IoT Hub library
CONFIG_AZURE_IOT_HUB=y

# Host name is set by DPS
CONFIG_AZURE_IOT_HUB_HOSTNAME=&amp;quot;&amp;quot;

CONFIG_MQTT_HELPER_SEC_TAG=11
CONFIG_MQTT_HELPER_SECONDARY_SEC_TAG=10

# MQTT - Maximum MQTT keepalive timeout specified by Azure IoT Hub
CONFIG_MQTT_KEEPALIVE=60

# LED control
CONFIG_DK_LIBRARY=y

# Heap and stacks
CONFIG_HEAP_MEM_POOL_SIZE=10000
CONFIG_MAIN_STACK_SIZE=10000
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8000

# Settings, needed for Azure Device Provisioning Service
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_FCB=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_FCB=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_AZURE_IOT_HUB_DPS=y

# The ID scope can be omitted and provided at run time
CONFIG_AZURE_IOT_HUB_DPS_ID_SCOPE=&amp;quot;xxxxxxxxxx&amp;quot; 
CONFIG_HW_ID_LIBRARY=y
CONFIG_HWINFO=y

CONFIG_NEWLIB_LIBC_NANO=n

CONFIG_REBOOT=y

# Watchdog
CONFIG_WATCHDOG=y
CONFIG_WDT_DISABLE_AT_BOOT=n

#FOTA
CONFIG_AZURE_FOTA=y
CONFIG_AZURE_FOTA_APP_VERSION_AUTO=y
CONFIG_AZURE_FOTA_TLS=y
CONFIG_AZURE_FOTA_SEC_TAG=11
CONFIG_FOTA_DOWNLOAD=y
CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y

CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_HTTP_FRAG_SIZE_1024=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_DOWNLOAD_CLIENT_BUF_SIZE=2300

# DFU Target
CONFIG_DFU_TARGET=y

# Application update support
CONFIG_BOOTLOADER_MCUBOOT=y

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_STREAM_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I also use these to define some memory regions in my code, but that&amp;#39;s only like ~5 kB combined memory:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;K_MSGQ_DEFINE&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;uart_msgq&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;255&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;10&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;4&lt;/span&gt;&lt;span&gt;),&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;K_THREAD_STACK_DEFINE&lt;/span&gt;&lt;span&gt;(application_stack_area, KB(2)&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;K_THREAD_STACK_DEFINE&lt;/span&gt;&lt;span&gt;(threadStack, &lt;/span&gt;&lt;span&gt;512&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;I&amp;#39;m building it for the nrf9160dk_nrf9160_ns board.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Can you see anything here that should reduce the available heap size for std::string?&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/483186?ContentTypeID=1</link><pubDate>Tue, 14 May 2024 08:42:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f867fc6d-e07f-4ff3-b8b7-0294917bc7ac</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Anyway, the default value for this is -1, meaning the rest of the RAM is used as malloc() space. Meaning the best you can achieve is by keeping the default value and not changing anything. I tested this, and changing &lt;span&gt;CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE does affect the amount of space that can be allocated for std::string.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/482307?ContentTypeID=1</link><pubDate>Tue, 07 May 2024 13:48:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c778010-64bf-459d-96bc-661c9c54e083</guid><dc:creator>NilsDR</dc:creator><description>&lt;p&gt;Hello Hakon,&lt;/p&gt;
&lt;p&gt;Yes, I&amp;#39;m able to build the linked sample, but it&amp;#39;s using the&amp;nbsp;CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE symbol and not the&amp;nbsp;&lt;span&gt;CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE symbol. This also requires&amp;nbsp;MINIMAL_LIBC_MALLOC and&amp;nbsp; MINIMAL_LIBC to be set&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/482299?ContentTypeID=1</link><pubDate>Tue, 07 May 2024 13:34:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54e18680-c4db-4e14-8d18-e44c1bddb551</guid><dc:creator>Hakon</dc:creator><description>[quote user="NilsDR"]I&amp;#39;m using nRF version 2.4.0 and toolchain 2.4.0[/quote]
&lt;p&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.0-ncs-branch/samples/cpp_synchronization/prj.conf"&gt;https://github.com/nrfconnect/sdk-zephyr/blob/v2.4.0-ncs-branch/samples/cpp_synchronization/prj.conf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It should be available for NCS 2.4.0. Are you able to build the linked sample?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/482015?ContentTypeID=1</link><pubDate>Mon, 06 May 2024 12:08:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37233d3c-0e95-4773-9a98-a5ba3cfc5827</guid><dc:creator>NilsDR</dc:creator><description>&lt;p&gt;That is an undefined symbol in my project. When was it added? I&amp;#39;m using nRF version 2.4.0 and toolchain 2.4.0&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/481973?ContentTypeID=1</link><pubDate>Mon, 06 May 2024 10:50:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba744e4b-46a3-49ab-9529-3cf2de8ee3a0</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;You may try to set CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE?&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/481905?ContentTypeID=1</link><pubDate>Mon, 06 May 2024 05:23:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd0f1324-cc3a-4ec4-b840-4fbd44ad4071</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello Nils,&lt;/p&gt;
&lt;p&gt;I have been looking into the issue. I will reply you soon.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/481569?ContentTypeID=1</link><pubDate>Thu, 02 May 2024 13:29:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1268c43-c37e-4150-8b56-0af148712e6f</guid><dc:creator>NilsDR</dc:creator><description>&lt;p&gt;I read a little more into it and it seems like the std::string is allocating on the heap as it uses the c++ &amp;quot;new&amp;quot; keyword. So maybe a solution is to just configure the heap size to be larger. It doesn&amp;#39;t seem like its using the heap defined with CONFIG_HEAP_MEM_POOL_SIZE though. Is there anyway to tell the processor to allocate to the heap defined by the&amp;nbsp;&lt;span&gt;CONFIG_HEAP_MEM_POOL_SIZE?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/481362?ContentTypeID=1</link><pubDate>Wed, 01 May 2024 07:05:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2cb55183-f4a1-4258-a3a6-39eeddee5b50</guid><dc:creator>NilsDR</dc:creator><description>&lt;p&gt;I&amp;#39;ve made this small test sample:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;int main(void)
{	
	std::string test;

	thread_analyzer_print();

	for(int i = 0; i &amp;lt; 10000; i++)
	{
		test += std::to_string(i);

		if(i % 1000 == 0)
			thread_analyzer_print();

		k_sleep(K_MSEC(10));
	}

	return 0;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The memory prints doesn&amp;#39;t show a increase in usage when I concatenate to the string. If it is not allocated on the main stack, then where is it allocated?&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.380,676] &amp;lt;inf&amp;gt; thread_analyzer: Thread analyze:
[00:00:00.387,268] &amp;lt;inf&amp;gt; thread_analyzer:  mqtt_helper_thread  : STACK: unused 2528 usage 32 / 2560 (1 %); CPU: 0 %
[00:00:00.398,925] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:00.406,951] &amp;lt;inf&amp;gt; thread_analyzer:  0x2000d308          : STACK: unused 992 usage 32 / 1024 (3 %); CPU: 0 %
[00:00:00.418,487] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:00.427,337] &amp;lt;inf&amp;gt; thread_analyzer:  sysworkq            : STACK: unused 7800 usage 200 / 8000 (2 %); CPU: 0 %
[00:00:00.439,056] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:00.446,960] &amp;lt;inf&amp;gt; thread_analyzer:  idle                : STACK: unused 288 usage 32 / 320 (10 %); CPU: 0 %
[00:00:00.458,496] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:00.482,208] &amp;lt;inf&amp;gt; thread_analyzer:  main                : STACK: unused 124592 usage 944 / 125536 (0 %); CPU: 100 %
[00:00:00.494,506] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 3519
[00:00:00.502,838] &amp;lt;inf&amp;gt; thread_analyzer:  ISR0                : STACK: unused 1624 usage 424 / 2048 (20 %)
[00:00:00.513,732] &amp;lt;inf&amp;gt; thread_analyzer: Thread analyze:
[00:00:00.520,324] &amp;lt;inf&amp;gt; thread_analyzer:  mqtt_helper_thread  : STACK: unused 2528 usage 32 / 2560 (1 %); CPU: 0 %
[00:00:00.531,982] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:00.540,008] &amp;lt;inf&amp;gt; thread_analyzer:  0x2000d308          : STACK: unused 992 usage 32 / 1024 (3 %); CPU: 0 %
[00:00:00.551,544] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:00.560,363] &amp;lt;inf&amp;gt; thread_analyzer:  sysworkq            : STACK: unused 7800 usage 200 / 8000 (2 %); CPU: 0 %
[00:00:00.572,113] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:00.579,986] &amp;lt;inf&amp;gt; thread_analyzer:  idle                : STACK: unused 288 usage 32 / 320 (10 %); CPU: 0 %
[00:00:00.591,552] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:00.615,295] &amp;lt;inf&amp;gt; thread_analyzer:  main                : STACK: unused 124592 usage 944 / 125536 (0 %); CPU: 100 %
[00:00:00.627,563] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 7880
[00:00:00.635,894] &amp;lt;inf&amp;gt; thread_analyzer:  ISR0                : STACK: unused 1624 usage 424 / 2048 (20 %)
[00:00:10.748,352] &amp;lt;inf&amp;gt; thread_analyzer: Thread analyze:
[00:00:10.754,943] &amp;lt;inf&amp;gt; thread_analyzer:  mqtt_helper_thread  : STACK: unused 2368 usage 192 / 2560 (7 %); CPU: 0 %
[00:00:10.766,662] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1
[00:00:10.774,658] &amp;lt;inf&amp;gt; thread_analyzer:  0x2000d308          : STACK: unused 824 usage 200 / 1024 (19 %); CPU: 0 %
[00:00:10.786,407] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1
[00:00:10.795,257] &amp;lt;inf&amp;gt; thread_analyzer:  sysworkq            : STACK: unused 7800 usage 200 / 8000 (2 %); CPU: 0 %
[00:00:10.807,006] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:10.814,880] &amp;lt;inf&amp;gt; thread_analyzer:  idle                : STACK: unused 236 usage 84 / 320 (26 %); CPU: 96 %
[00:00:10.826,538] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 329007
[00:00:10.850,738] &amp;lt;inf&amp;gt; thread_analyzer:  main                : STACK: unused 124592 usage 944 / 125536 (0 %); CPU: 3 %
[00:00:10.862,884] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 13279
[00:00:10.871,276] &amp;lt;inf&amp;gt; thread_analyzer:  ISR0                : STACK: unused 1624 usage 424 / 2048 (20 %)
[00:00:20.983,581] &amp;lt;inf&amp;gt; thread_analyzer: Thread analyze:
[00:00:20.990,173] &amp;lt;inf&amp;gt; thread_analyzer:  mqtt_helper_thread  : STACK: unused 2368 usage 192 / 2560 (7 %); CPU: 0 %
[00:00:21.001,892] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1
[00:00:21.009,887] &amp;lt;inf&amp;gt; thread_analyzer:  0x2000d308          : STACK: unused 824 usage 200 / 1024 (19 %); CPU: 0 %
[00:00:21.021,636] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1
[00:00:21.030,487] &amp;lt;inf&amp;gt; thread_analyzer:  sysworkq            : STACK: unused 7800 usage 200 / 8000 (2 %); CPU: 0 %
[00:00:21.042,205] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:21.050,109] &amp;lt;inf&amp;gt; thread_analyzer:  idle                : STACK: unused 236 usage 84 / 320 (26 %); CPU: 97 %
[00:00:21.061,737] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 658007
[00:00:21.085,937] &amp;lt;inf&amp;gt; thread_analyzer:  main                : STACK: unused 124592 usage 944 / 125536 (0 %); CPU: 2 %
[00:00:21.098,052] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 18668
[00:00:21.106,445] &amp;lt;inf&amp;gt; thread_analyzer:  ISR0                : STACK: unused 1624 usage 424 / 2048 (20 %)
[00:00:31.218,780] &amp;lt;inf&amp;gt; thread_analyzer: Thread analyze:
[00:00:31.225,372] &amp;lt;inf&amp;gt; thread_analyzer:  mqtt_helper_thread  : STACK: unused 2368 usage 192 / 2560 (7 %); CPU: 0 %
[00:00:31.237,091] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1
[00:00:31.245,086] &amp;lt;inf&amp;gt; thread_analyzer:  0x2000d308          : STACK: unused 824 usage 200 / 1024 (19 %); CPU: 0 %
[00:00:31.256,835] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1
[00:00:31.265,655] &amp;lt;inf&amp;gt; thread_analyzer:  sysworkq            : STACK: unused 7800 usage 200 / 8000 (2 %); CPU: 0 %
[00:00:31.277,404] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:31.285,278] &amp;lt;inf&amp;gt; thread_analyzer:  idle                : STACK: unused 236 usage 84 / 320 (26 %); CPU: 97 %
[00:00:31.296,905] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 987008
[00:00:31.321,105] &amp;lt;inf&amp;gt; thread_analyzer:  main                : STACK: unused 124592 usage 944 / 125536 (0 %); CPU: 2 %
[00:00:31.333,221] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 24055
[00:00:31.341,644] &amp;lt;inf&amp;gt; thread_analyzer:  ISR0                : STACK: unused 1624 usage 424 / 2048 (20 %)
[00:00:41.453,887] &amp;lt;inf&amp;gt; thread_analyzer: Thread analyze:
[00:00:41.460,479] &amp;lt;inf&amp;gt; thread_analyzer:  mqtt_helper_thread  : STACK: unused 2368 usage 192 / 2560 (7 %); CPU: 0 %
[00:00:41.472,198] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1
[00:00:41.480,224] &amp;lt;inf&amp;gt; thread_analyzer:  0x2000d308          : STACK: unused 824 usage 200 / 1024 (19 %); CPU: 0 %
[00:00:41.491,943] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1
[00:00:41.500,793] &amp;lt;inf&amp;gt; thread_analyzer:  sysworkq            : STACK: unused 7800 usage 200 / 8000 (2 %); CPU: 0 %
[00:00:41.512,542] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 0
[00:00:41.520,416] &amp;lt;inf&amp;gt; thread_analyzer:  idle                : STACK: unused 236 usage 84 / 320 (26 %); CPU: 97 %
[00:00:41.532,043] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 1316009
[00:00:41.556,335] &amp;lt;inf&amp;gt; thread_analyzer:  main                : STACK: unused 124592 usage 944 / 125536 (0 %); CPU: 2 %
[00:00:41.568,450] &amp;lt;inf&amp;gt; thread_analyzer:       : Total CPU cycles used: 29443
[00:00:41.576,873] &amp;lt;inf&amp;gt; thread_analyzer:  ISR0                : STACK: unused 1624 usage 424 / 2048 (20 %)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;After 5000 iterations the program crashes with the same stack trace. Still seems like an allocation problem.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1714546977173v1.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Memory allocation</title><link>https://devzone.nordicsemi.com/thread/481268?ContentTypeID=1</link><pubDate>Tue, 30 Apr 2024 12:02:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8888ddb3-b891-4d80-b1a1-484d3519de00</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Could you please share the&amp;nbsp;&lt;span&gt;string allocation part from your code?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;BR&lt;br /&gt;Kazi&amp;nbsp;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>