Page 1 of 1

[Solved] BluetoothSerial Memory Consumption problem

Posted: Thu Oct 11, 2018 11:50 am
by human890209
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?

Re: Help! BluetoothSerial Memory Consumption problem

Posted: Tue Oct 16, 2018 6:28 am
by human890209
I've found this post

and SPP is Classic API ... index.html

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