Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leakage in getting manufacture data and the fix. #725

Closed
l8l8l opened this issue Aug 8, 2020 · 2 comments · Fixed by #736
Closed

Memory leakage in getting manufacture data and the fix. #725

l8l8l opened this issue Aug 8, 2020 · 2 comments · Fixed by #736
Milestone

Comments

@l8l8l
Copy link

l8l8l commented Aug 8, 2020

BLE Scan runs out of memory when processing manufacture data, 'freemem' reduced very quickly and leads frequent crash.

---------ZgatewayBT.ino-------------

  if (advertisedDevice.haveManufacturerData()) {
    char* manufacturerdata = BLEUtils::buildHexData(NULL, (uint8_t*)advertisedDevice.getManufacturerData().data(), advertisedDevice.getManufacturerData().length());
    Log.trace(F("Manufacturer Data: %s" CR), manufacturerdata);
    BLEdata.set("manufacturerdata", manufacturerdata);
    free(manufacturerdata); **<-  Add the pointer free here.**
  }

Tested with default_envs = esp32dev-ble, pubUnknownBLEServiceData, pubBLEManufacturerData, pubBLEServiceUUID are enabled to scan BLE Beacons. freemem stays at 50KB.

@1technophile 1technophile added this to the v0.9.5 milestone Aug 8, 2020
@1technophile
Copy link
Owner

Thanks for pointing that

@jmw6773
Copy link
Contributor

jmw6773 commented Aug 14, 2020

@l8l8l , great find. This seems to have resolved the random crashing I was seeing on my ESP32 device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants