Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

BLE Server memory leak on connect/disconnect #9834

mirozmrzli started this conversation in Question - Community Help
Discussion options

Hello,

I apologize if this question has been answered before.

I'm using idf-release/v4.4

Using the following code, each time there is connect/disconnect event heap memory goes down by 1k, more or less. Am I missing something obvious or is there a bug in implementation?

void Ble::start()
{
 ESP_LOGW(TAG, "Starting BLE...");
 uint8_t wifi_mac[8];
 esp_read_mac(wifi_mac, ESP_MAC_WIFI_STA);
 sprintf(m_name, "WP_%u_%02x%02x%02x", SETTINGS.device.id, wifi_mac[3], wifi_mac[4], wifi_mac[5]);
 BLEDevice::init(m_name);
 assert(m_server = BLEDevice::createServer());
 m_server->setCallbacks(this);
 assert(m_service = m_server->createService(SERVICE_UUID));
 m_characteristic = m_service->createCharacteristic(CHARACTERISTIC_UUID, 
	 BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE | BLECharacteristic::PROPERTY_NOTIFY);
 m_characteristic->addDescriptor(new BLE2902());
 m_characteristic->setCallbacks(this);
 m_service->start();
 assert(m_advertising = m_server->getAdvertising());
 m_advertising->addServiceUUID(SERVICE_UUID);
 m_advertising->start();		
}
void Ble::onConnect(BLEServer* pServer)
{
 uint16_t id = pServer->getConnId();
 ESP_LOGI(TAG, "%d connected", id);
}
void Ble::onDisconnect(BLEServer* pServer)
{
 uint16_t id = pServer->getConnId();
 ESP_LOGI(TAG, "%d disconnected", id);
 m_advertising->start();
}
You must be logged in to vote

Replies: 1 comment

Comment options

I believe I was able to reproduce this problem, I will create an issue and link it here

Edit: Here it is

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /