[Solved] BluetoothSerial Memory Consumption problem

human890209
Posts: 54
Joined: Wed Aug 15, 2018 8:56 am

[Solved] BluetoothSerial Memory Consumption problem

Postby human890209 » Thu Oct 11, 2018 11:50 am

Hi,
I tested the BluetoothSerial example on my ESP32 dev board. it works!
But I use Serial.println(ESP.getFreeHeap()) to check the memory usage, it consumes a lot of RAM.

My FreeHeap is about 380k when running the Blink example
After BluetoothSerial.begin(...) it remains about 150k which means 60% of the RAM is consumed.
Question 1
Can I modify the BluetoothSerial.h and BluetoothSerial.cpp to disable some unnecessary part to free some RAM?

For now, I'm trying to add some switch to control the BluetoothSerial enabled or disabled such as a toggle button.
But I've found that only #include "BluetoothSerial.h" without anything else will consume about 80k of RAM.
How does the 80k be consumed with no instance initialized or begin()?
Question 2
Can I get the 80k back when the BluetoothSerial is not activated?
Last edited by human890209 on Tue Oct 16, 2018 6:50 am, edited 1 time in total.

human890209
Posts: 54
Joined: Wed Aug 15, 2018 8:56 am

Re: Help! BluetoothSerial Memory Consumption problem

Postby human890209 » Tue Oct 16, 2018 6:28 am

I've found this post
viewtopic.php?f=13&t=3139&p=32305#p32305

and SPP is Classic API
https://docs.espressif.com/projects/esp ... index.html

So this could recover a lot of SRAM when Bluetooth is not used anymore.

Who is online

Users browsing this forum: Bing [Bot], PepeTheGreat and 52 guests