How to increase number of records in heap_tracing buffer heap_trace_record_t?

nayana
Posts: 4
Joined: Thu Jan 18, 2018 8:50 am

How to increase number of records in heap_tracing buffer heap_trace_record_t?

Postby nayana » Thu Jan 18, 2018 11:12 am

Hi

I am working on memory leak analysis in esp32. I am facing problem with heap_trace_record_t type buffer, this will record the leaks and prints when heap_tracing is enabled in menuconfig. But this buffer is overflowing, can anyone tell me how to increase the buffer size to record more leaks.

I tried by changing the value assigned to that buffer in library file but still i am getting 14 allocation record not more than this. please reply me as soon as possible.

log :
1736 bytes 'leaked' in trace (14 allocations)
total allocations 17222 total frees 17275
(NB: Buffer has overflowed, so trace data is incomplete.)
MALLOC_CAP_8BIT critical leak: Before 242052 bytes free, After 229160 bytes free (delta 12892)

Thanks and Regads
Nayana

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: How to increase number of records in heap_tracing buffer heap_trace_record_t?

Postby ESP_Angus » Thu Jan 18, 2018 10:32 pm

Hi Nayana,

The buffer is allocated in the application code which initialises & enables heap tracing. If you look at the example in the docs (scroll down a small way from the linked heading), you'll see there is a macro NUM_RECORDS which is used for the size of the "trace_record" array and also passed to heap_trace_init_standalone(). If you change this macro then the number of records used in the buffer will also change.

If you're still running out of buffer while trying to leak check, check you're using heap_trace_start(HEAP_TRACE_LEAKS) - starting in "ALL" mode records every allocation and there can be a lot of these! LEAKS mode will delete an entry from the buffer after the memory is freed.


Angus

nayana
Posts: 4
Joined: Thu Jan 18, 2018 8:50 am

Re: How to increase number of records in heap_tracing buffer heap_trace_record_t?

Postby nayana » Fri Jan 19, 2018 7:43 am

Thank you for your reply, i will try this solution.

Regards
Nayana

Who is online

Users browsing this forum: No registered users and 309 guests