Other Parts Discussed in Thread: SYSCONFIG,
Hi
I am trying to allocate 23kB memory for two buffers in our thread using malloc in runtime
We are reallocating the same 23kB for two buffers once after freeing the previous memory
For getting the heap size below was included in our code,
ICall_heapStats_t stats;
ICall_getHeapStats(&stats);
gcam_printf(LOGD,"Heap stats: Total Heap Size: %lu, Largest Free Size: %lu " \
"Total Free Size: %lu\r\n",
stats.totalSize,
stats.largestFreeSize,
stats.totalFreeSize);
Below are the logs of allocating and freeing . On the 6th iteration We are not able to allocate the memory and RS_ENOMEM error is occures
Heap stats: Total Heap Size: 93808, Largest Free Size: 67040 Total Free Size: 68996
handle @2000557c size 23504 size_handle 4
Heap stats: Total Heap Size: 93808, Largest Free Size: 43524 Total Free Size: 45480
handle @20005578 size 23504 size_handle 4
handle_deinit after free @00000000
handle_deinit after free @00000000
Heap stats: Total Heap Size: 93808, Largest Free Size: 67040 Total Free Size: 69404
handle @2000557c size 23504 size_handle 4
Heap stats: Total Heap Size: 93808, Largest Free Size: 43524 Total Free Size: 45888
handle @20005578 size 23504 size_handle 4
handle_deinit after free @00000000
handle_deinit after free @00000000
Heap stats: Total Heap Size: 93808, Largest Free Size: 67040 Total Free Size: 70092
handle @2000557c size 23504 size_handle 4
Heap stats: Total Heap Size: 93808, Largest Free Size: 43524 Total Free Size: 46576
handle @20005578 size 23504 size_handle 4
handle_deinit after free @00000000
handle_deinit after free @00000000
Heap stats: Total Heap Size: 93808, Largest Free Size: 67040 Total Free Size: 106800
handle @2000557c size 23504 size_handle 4
Heap stats: Total Heap Size: 93808, Largest Free Size: 43524 Total Free Size: 83284
handle @20005578 size 23504 size_handle 4
handle_deinit after free @00000000
handle_deinit after free @00000000
Heap stats: Total Heap Size: 93808, Largest Free Size: 47024 Total Free Size: 143508
handle @2000557c size 23504 size_handle 4
Heap stats: Total Heap Size: 93808, Largest Free Size: 23508 Total Free Size: 119992
handle @20005578 size 23504 size_handle 4
handle_deinit after free @00000000
handle_deinit after free @00000000
Heap stats: Total Heap Size: 93808, Largest Free Size: 46872 Total Free Size: 160480
handle @2000557c size 23504 size_handle 4
Heap stats: Total Heap Size: 93808, Largest Free Size: 23356 Total Free Size: 136964
handle @20005578 size 23504 size_handle 4
RS_ENOMEM is occured,
Here we are freeing and only trying then why still heap memory is not getting released?
free(handle);
handle = NULL;
Can you please help here and let us know what can fix this issue?