Arm Mbed and Pelion Device Management support forum

Error on allocating bigger chunk of memory in malloc even though heap is available

Hello!

I’m trying to run a simple application, but I can’t get it working. When my application wants to allocate 540B then the application crashes.

I’m printing out the current stack usage per thread and the global heap statistics:

maj 18 14:13:28 New job to do
maj 18 14:13:28 New job to do
maj 18 14:13:28 Executing job
maj 18 14:13:28 Will wait for: 1 seconds (finishing at: 1)
maj 18 14:13:29 Heap: currently in use: 22068, max allocated: 22253, cumulative sum ever allocated: 22397, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:29 Thread: 0x20001B04, max in use: 856, stack size: 2048
maj 18 14:13:29 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:29 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:29 Handling job result
maj 18 14:13:29 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:29 New job to do
maj 18 14:13:29 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:29 New job to do
maj 18 14:13:29 Executing job
maj 18 14:13:29 Thread: 0x20002BFC, max in use: 376, stack size: 8192
maj 18 14:13:29 New job to do
maj 18 14:13:29 Taking measurement
maj 18 14:13:29 Executing job
maj 18 14:13:29 Handling job result
maj 18 14:13:29 Will wait for: 1 seconds (finishing at: 2)
maj 18 14:13:29 New job to do
jmaj 18 14:13:30 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 24944, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:30 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:30 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:30 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:30 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:30 Handling job result
maj 18 14:13:30 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:30 New job to do
maj 18 14:13:30 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:30 New job to do
maj 18 14:13:30 Executing job
maj 18 14:13:30 New job to do
maj 18 14:13:30 Taking measurement
maj 18 14:13:30 Executing job
maj 18 14:13:30 Handling job result
maj 18 14:13:30 Will wait for: 1 seconds (finishing at: 3)
maj 18 14:13:30 New job to do
maj 18 14:13:31 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 27491, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:31 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:31 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:31 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:31 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:31 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:31 Handling job result
maj 18 14:13:31 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:31 New job to do
maj 18 14:13:31 New job to do
maj 18 14:13:31 Executing job
maj 18 14:13:31 New job to do
maj 18 14:13:31 Taking measurement
maj 18 14:13:31 Executing job
maj 18 14:13:31 Handling job result
maj 18 14:13:31 Will wait for: 1 seconds (finishing at: 4)
maj 18 14:13:31 New job to do
maj 18 14:13:32 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 30038, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:32 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:32 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:32 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:32 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:32 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:32 Handling job result
maj 18 14:13:32 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:32 New job to do
maj 18 14:13:32 New job to do
maj 18 14:13:32 Executing job
maj 18 14:13:32 New job to do
maj 18 14:13:32 Taking measurement
maj 18 14:13:32 Executing job
maj 18 14:13:32 Handling job result
maj 18 14:13:32 Will wait for: 1 seconds (finishing at: 5)
maj 18 14:13:32 New job to do
maj 18 14:13:33 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 32585, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:33 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:33 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:33 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:33 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:33 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:33 Handling job result
maj 18 14:13:33 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:33 New job to do
maj 18 14:13:33 New job to do
maj 18 14:13:33 Executing job
maj 18 14:13:33 New job to do
maj 18 14:13:33 Taking measurement
maj 18 14:13:33 Executing job
maj 18 14:13:33 Handling job result
maj 18 14:13:33 Will wait for: 1 seconds (finishing at: 6)
maj 18 14:13:33 New job to do
maj 18 14:13:34 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 35132, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:34 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:34 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:34 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:34 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:34 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:34 Handling job result
maj 18 14:13:34 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:34 New job to do
maj 18 14:13:34 New job to do
maj 18 14:13:34 Executing job
maj 18 14:13:34 New job to do
maj 18 14:13:34 Taking measurement
maj 18 14:13:34 Executing job
maj 18 14:13:34 Handling job result
maj 18 14:13:34 Will wait for: 1 seconds (finishing at: 7)
maj 18 14:13:34 New job to do
maj 18 14:13:35 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 37679, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:35 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:35 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:35 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:35 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:35 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:35 Handling job result
maj 18 14:13:35 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:35 New job to do
maj 18 14:13:35 New job to do
maj 18 14:13:35 Executing job
maj 18 14:13:35 New job to do
maj 18 14:13:35 Taking measurement
maj 18 14:13:35 Executing job
maj 18 14:13:35 Handling job result
maj 18 14:13:35 Will wait for: 1 seconds (finishing at: 8)
maj 18 14:13:35 New job to do
maj 18 14:13:36 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 40226, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:36 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:36 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:36 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:36 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:36 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:36 Handling job result
maj 18 14:13:36 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:36 New job to do
maj 18 14:13:36 New job to do
maj 18 14:13:36 Executing job
maj 18 14:13:36 New job to do
maj 18 14:13:36 Taking measurement
maj 18 14:13:36 Executing job
maj 18 14:13:36 Handling job result
maj 18 14:13:36 Will wait for: 1 seconds (finishing at: 9)
maj 18 14:13:36 New job to do
maj 18 14:13:37 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 42773, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:37 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:37 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:37 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:37 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:37 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:37 Handling job result
maj 18 14:13:37 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:37 New job to do
maj 18 14:13:37 New job to do
maj 18 14:13:37 Executing job
maj 18 14:13:37 New job to do
maj 18 14:13:37 Taking measurement
maj 18 14:13:37 Executing job
maj 18 14:13:37 Handling job result
maj 18 14:13:37 Will wait for: 1 seconds (finishing at: 10)
maj 18 14:13:37 New job to do
maj 18 14:13:38 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 45320, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:38 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:38 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:38 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:38 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:38 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:38 Handling job result
maj 18 14:13:38 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:38 New job to do
maj 18 14:13:38 New job to do
maj 18 14:13:38 Executing job
maj 18 14:13:38 New job to do
maj 18 14:13:38 Taking measurement
maj 18 14:13:38 Executing job
maj 18 14:13:38 Handling job result
maj 18 14:13:38 Will wait for: 1 seconds (finishing at: 11)
maj 18 14:13:38 New job to do
maj 18 14:13:39 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 47867, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:39 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:39 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:39 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:39 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:39 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:39 Handling job result
maj 18 14:13:39 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:39 New job to do
maj 18 14:13:39 New job to do
maj 18 14:13:39 Executing job
maj 18 14:13:39 New job to do
maj 18 14:13:39 Taking measurement
maj 18 14:13:39 Executing job
maj 18 14:13:39 Handling job result
maj 18 14:13:39 Will wait for: 1 seconds (finishing at: 12)
maj 18 14:13:39 New job to do
maj 18 14:13:40 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 50414, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:40 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:40 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:40 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:40 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:40 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:40 Handling job result
maj 18 14:13:40 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:40 New job to do
maj 18 14:13:40 New job to do
maj 18 14:13:40 Executing job
maj 18 14:13:40 New job to do
maj 18 14:13:40 Taking measurement
maj 18 14:13:40 Executing job
maj 18 14:13:40 Handling job result
maj 18 14:13:40 Will wait for: 1 seconds (finishing at: 13)
maj 18 14:13:40 New job to do
maj 18 14:13:41 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 52961, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:41 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:41 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:41 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:41 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:41 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:41 Handling job result
maj 18 14:13:41 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:41 New job to do
maj 18 14:13:41 New job to do
maj 18 14:13:41 Executing job
maj 18 14:13:41 New job to do
maj 18 14:13:41 Taking measurement
maj 18 14:13:41 Executing job
maj 18 14:13:41 Handling job result
maj 18 14:13:41 Will wait for: 1 seconds (finishing at: 14)
maj 18 14:13:41 New job to do
maj 18 14:13:42 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 55508, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:42 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:42 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:42 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:42 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:42 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:42 Handling job result
maj 18 14:13:42 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:42 New job to do
maj 18 14:13:42 New job to do
maj 18 14:13:42 Executing job
maj 18 14:13:42 New job to do
maj 18 14:13:42 Taking measurement
maj 18 14:13:42 Executing job
maj 18 14:13:42 Handling job result
maj 18 14:13:42 Will wait for: 1 seconds (finishing at: 15)
maj 18 14:13:42 New job to do
maj 18 14:13:43 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 58055, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:43 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:43 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:43 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:43 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:43 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:43 Handling job result
maj 18 14:13:43 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:43 New job to do
maj 18 14:13:43 New job to do
maj 18 14:13:43 Executing job
maj 18 14:13:43 New job to do
maj 18 14:13:43 Taking measurement
maj 18 14:13:43 Executing job
maj 18 14:13:43 Handling job result
maj 18 14:13:43 Will wait for: 1 seconds (finishing at: 16)
maj 18 14:13:43 New job to do
maj 18 14:13:44 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 60602, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:44 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:44 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:44 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:44 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:44 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:44 Handling job result
maj 18 14:13:44 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:44 New job to do
maj 18 14:13:44 New job to do
maj 18 14:13:44 Executing job
maj 18 14:13:44 New job to do
maj 18 14:13:44 Taking measurement
maj 18 14:13:44 Executing job
maj 18 14:13:44 Handling job result
maj 18 14:13:44 Will wait for: 1 seconds (finishing at: 17)
maj 18 14:13:44 New job to do
maj 18 14:13:45 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 63149, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:45 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:45 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:45 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:45 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:45 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:45 Handling job result
maj 18 14:13:45 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:45 New job to do
maj 18 14:13:45 New job to do
maj 18 14:13:45 Executing job
maj 18 14:13:45 New job to do
maj 18 14:13:45 Taking measurement
maj 18 14:13:45 Executing job
maj 18 14:13:45 Handling job result
maj 18 14:13:45 Will wait for: 1 seconds (finishing at: 18)
maj 18 14:13:45 New job to do
maj 18 14:13:46 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 65696, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:46 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:46 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:46 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:46 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:46 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:46 Handling job result
maj 18 14:13:46 Thread: 0x20002BFC, max in use: 1080, stack size: 8192
maj 18 14:13:46 New job to do
maj 18 14:13:46 New job to do
maj 18 14:13:46 Executing job
maj 18 14:13:46 New job to do
maj 18 14:13:46 Taking measurement
maj 18 14:13:46 Executing job
maj 18 14:13:46 Handling job result
maj 18 14:13:46 Will wait for: 1 seconds (finishing at: 19)
maj 18 14:13:46 New job to do
maj 18 14:13:47 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 68243, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:47 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:47 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:47 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:47 Thread: 0x200028C8, max in use: 824, stack size: 8192
maj 18 14:13:47 Thread: 0x20001074, max in use: 104, stack size: 768
maj 18 14:13:47 Handling job result
maj 18 14:13:47 Thread: 0x20002BFC, max in use: 1088, stack size: 8192
maj 18 14:13:47 New job to do
maj 18 14:13:47 New job to do
maj 18 14:13:47 Executing job
maj 18 14:13:47 New job to do
maj 18 14:13:47 Taking measurement
maj 18 14:13:47 Executing job
maj 18 14:13:47 Handling job result
maj 18 14:13:47 Will wait for: 1 seconds (finishing at: 20)
maj 18 14:13:47 New job to do
maj 18 14:13:48 Heap: currently in use: 22068, max allocated: 22664, cumulative sum ever allocated: 70790, heap size: 52528, number of allocs: 9, failed allocs: 0, overhead: 140
maj 18 14:13:48 Thread: 0x20001B04, max in use: 944, stack size: 2048
maj 18 14:13:48 Thread: 0x20000F68, max in use: 1920, stack size: 4096
maj 18 14:13:48 Thread: 0x200010B8, max in use: 64, stack size: 768
maj 18 14:13:48 Thread: 0x200028C8, max in use: 824, stack size: 8192

Backtrace shows the error in:

bt
#0 _wait_us_ticks (ticks=ticks@entry=400000) at /home/kacper/.platformio/packages/framework-mbed/platform/source/mbed_wait_api_no_rtos.c:66
#1 0x08001ce0 in _wait_us_inline (us=400000) at /home/kacper/.platformio/packages/framework-mbed/platform/mbed_wait_api.h:173
#2 mbed_die () at /home/kacper/.platformio/packages/framework-mbed/platform/source/mbed_board.c:46
#3 0x08001df0 in mbed_halt_system () at /home/kacper/.platformio/packages/framework-mbed/platform/source/mbed_error.c:108
#4 0x08002058 in mbed_error (error_status=error_status@entry=400000, error_msg=0x249f0 “\n\360”, <incomplete sequence \371>, error_value=error_value@entry=150000, filename=filename@entry=0x0, line_number=line_number@entry=0) at /home/kacper/.platformio/packages/framework-mbed/platform/source/mbed_error.c:314
#5 0x08002bde in trap_rtx_error (error_value=150000, rtx_status=-5, error_status=400000) at /home/kacper/.platformio/packages/framework-mbed/rtos/source/TARGET_CORTEX/mbed_rtx_handlers.c:115
#6 0x08003d70 in osMutexAcquire (mutex_id=, timeout=timeout@entry=4294967295) at /home/kacper/.platformio/packages/framework-mbed/rtos/source/TARGET_CORTEX/rtx5/RTX/Source/rtx_mutex.c:483
#7 0x08002902 in rtos::Mutex::lock (this=0x20000e84 <mem_trace_mutex+4>) at /home/kacper/.platformio/packages/framework-mbed/rtos/source/Mutex.cpp:61
#8 0x08002120 in mbed_mem_trace_lock () at /home/kacper/.platformio/packages/framework-mbed/platform/source/mbed_mem_trace.cpp:70
#9 0x08001b0c in malloc_wrapper (r=0x20000358 <impure_data>, size=size@entry=540, caller=0x8008d1d <std::vector<metrics_dto, std::allocator<metrics_dto> >::vector(std::vector<metrics_dto, std::allocator<metrics_dto> > const&)+44>) at /home/kacper/.platformio/packages/framework-mbed/platform/source/mbed_alloc_wrappers.cpp:104
#10 0x08002798 in operator new (count=count@entry=540) at /home/kacper/.platformio/packages/framework-mbed/platform/source/mbed_retarget.cpp:1601
#11 0x08008d1c in __gnu_cxx::new_allocator<metrics_dto>::allocate (this=0x20008488, __n=20) at /home/kacper/.platformio/packages/toolchain-gccarmnoneeabi/arm-none-eabi/include/c++/7.2.1/ext/new_allocator.h:111

What’s weird I can normally change the heap size of new thread (using “rtos.thread-stack-size”) between 4096 B and 8192 B, and the problem is still the same.

Could you help me debug this problem?