-
Notifications
You must be signed in to change notification settings - Fork 7.8k
BLE Server memory leak on connect/disconnect #9834
mirozmrzli
started this conversation in
Question - Community Help
-
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();
}
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment
-
I believe I was able to reproduce this problem, I will create an issue and link it here
Edit: Here it is
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment