Skip to content

Error : Memory leaks when using BluetoothSerial.h #2009

Closed
@NickChungVietNam

Description

@NickChungVietNam

Hardware:

Board: ESP32 Dev Module
Core Installation/update date: ?11/jul/2017?
IDE name: Arduino IDE
Flash Frequency: 40Mhz

Upload Speed: 115200
Computer OS: Windows 10

Description:

I need create some thing like "SerialBT.restart() " by try this code, But it leaks memory even i Delete it. Please help me.

Sketch:

#include "BluetoothSerial.h"

#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif


void setup() {
  Serial.begin(115200);
  uint8_t MY_BUFFER[50000];// Big buffer
BluetoothSerial *SerialBT;

while(true){
  SerialBT=new BluetoothSerial();
  SerialBT->begin("E");   delay(100);
   SerialBT->end();       delay(100);
   delete SerialBT;       delay(100);
   Serial.print("FreeHeap="); Serial.println(ESP.getFreeHeap());delay(100);
}
}

void loop() {
  
}

Debug Messages:

FreeHeap=108312
FreeHeap=104588
FreeHeap=100864
FreeHeap=97140
FreeHeap=93416
FreeHeap=89696
FreeHeap=85976
FreeHeap=82252
FreeHeap=78528
FreeHeap=74812
Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x4000c46c  PS      : 0x00060630  A0      : 0x80113516  A1      : 0x3ffdaf50  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x0000001c  A5      : 0x00000000  
A6      : 0x401797dc  A7      : 0x00000001  A8      : 0x800d6c11  A9      : 0x3ffdaf10  
A10     : 0x3ffe96c4  A11     : 0x00000000  A12     : 0x00000001  A13     : 0x3ffe778c  
A14     : 0x3ffe15f4  A15     : 0x00000084  SAR     : 0x00000008  EXCCAUSE: 0x0000001d  
EXCVADDR: 0x00000000  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000  

Backtrace: 0x4000c46c:0x3ffdaf50 0x40113513:0x3ffdaf60 0x40113de9:0x3ffdaf80 0x400ef449:0x3ffdafa0 0x400ef483:0x3ffdafc0



Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions