cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Wi-Fi Combo

AxLi_1746341
Honored Contributor

Test on CYW943438 with sdk-6.1.

To test if it is fine to repeat init/deinit bt_stack by calling wiced_bt_stack_init/wiced_bt_stack_deinit.

My test code is calling wiced_bt_ble_observe() once got BTM_ENABLED_EVT in the wiced_bt_stack_init callback.

The wiced_bt_ble_observe() scan for 10 seconds and once it is done.

Calling wiced_bt_stack_deinit and wiced_bt_stack_init again to re-start scan.

Observe the memory usage by mallinfo().

Then you can find the "Memory in use keep growth, the available memory becomes smaller and smaller.

i.e. It's clearly a memory leak while re-init bt stack.

4 Replies
AxLi_1746341
Honored Contributor

Attached a snip code to to duplicate the issue.

You will find in each bt init/de-init cycle, it lost about 192 bytes memory.

0 Likes
AlanH_86
Employee

Just out of curiosity... why would you ever do that?  What is the use case?

0 Likes
AxLi_1746341
Honored Contributor

arh

I reported a bug that "wiced_bt_ble_observe()" can silently stop working:

https://community.cypress.com/message/154089#154089

So I'm trying to address that issue by deinit btstack then init btstack again.

However, I just found the memory leak.

0 Likes
AxLi_1746341
Honored Contributor

In additional, this thread mentions that re-initializing the BLE Stack is the only way to change the scan mode from active to passive and vice-versa.

https://community.cypress.com/message/143689#143689

0 Likes