How to check the heap size of a program?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
SeKi_2184131
Level 2
Level 2
First like given

I wonder How much is assigned the size of heap memory when a program is built?


and how to check the heap size of the program?

0 Likes
1 Solution

Hi Sehee,

You can use the mallinfo( ) function to check the following.

            arena: total space allocated from system

            ordblks: number of non-inuse chunks

            smblks: unused -- always zero

            hblks: number of mmapped regions

            hblkhd: total space in mmapped regions

            usmblks: unused -- always zero

            fsmblks: unused -- always zero

            uordblks: total allocated space

            fordblks: total non-inuse space

            keepcost: top-most, releasable (via malloc_trim) space

You can check the usage in command_console_mallinfo.c which is in

  <WICED SDK>\libraries\utilities\command_console\mallinfo\command_console_mallinfo.c

Hope this helps.

Thanks,

Jaeyoung

View solution in original post

0 Likes
3 Replies
ShawnA_01
Employee
Employee
10 questions asked 5 comments on KBA First comment on KBA

I believe there are other threads on this, but did you try:  ble_trace1("free memory : %d", cfa_mm_MemFreeBytes());

0 Likes

Sorry, the text I provided was for the Bluetooth SDK... I don't know what it is for the WiFi SDK.

0 Likes

Hi Sehee,

You can use the mallinfo( ) function to check the following.

            arena: total space allocated from system

            ordblks: number of non-inuse chunks

            smblks: unused -- always zero

            hblks: number of mmapped regions

            hblkhd: total space in mmapped regions

            usmblks: unused -- always zero

            fsmblks: unused -- always zero

            uordblks: total allocated space

            fordblks: total non-inuse space

            keepcost: top-most, releasable (via malloc_trim) space

You can check the usage in command_console_mallinfo.c which is in

  <WICED SDK>\libraries\utilities\command_console\mallinfo\command_console_mallinfo.c

Hope this helps.

Thanks,

Jaeyoung

0 Likes