You can check the detailed usage of the heap memory by outputting the following HEAP SUMMARY log messages. You can check for memory leaks by looking at the changes in these numbers.

[HEAP] ==== HEAP SUMMARY =================
  Allocated :    138768 (  135 KB)
  Left      :  10346992 (10104 KB)
  Total     :  10485760 (10240 KB)
------------------------------------------
  Allocated at       Count    Total Size
   0xffe7154b           1         64522
   0xffe71558           1         61440
   0xffe51038           1          6776
   0x05000ba9           1            16
   0x05000bb4           1            32
   0xffe7a6eb           4           176
   0xffe7a722           4          1200
   0xffe7a76d           4          3952
------------------------------------------
  Total Count: 17
  No probrem is found. OK!
------------------------------------------

Allocated:
Total amount of allocated heap memory.
Left:
Remaining capacity of the heap memory.
Total:
Total amount of the heap memory.
Allocated at
Address of the program currently allocating memory.
Count
Current number of memories allocated from that address.
Total Size
Current total amount of memory allocated from that address.
Total Count
Total number of memories allocated in the heap memory.

You can output the HEAP SUMMARY log messages by following the steps below.
  1. In the Debug zone of Log settings, enable one of the zones ZONE_HEAP_CHK, ZONE_HEAP_LOG, and ZONE_HEAP_ALL.

  2. Do one of the following:

Note:

If ZONE_HEAP_CHK, ZONE_HEAP_LOG, and ZONE_HEAP_ALL are all disabled, only the contents of Allocated, Left, and Total will be output to the log message.

Limitations:

  • If the total number of allocated memory blocks is 8192 or less, the inspection function described in this section will work.
  • If more than 8192 memory blocks are allocated, only the contents of Allocated, Left, and Total will be output to the log message until the device is restarted.

See also



Last updated: 2021/05/31