Skip to content

Possible memory leak when receiving #68

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

Open
fredmaria opened this issue Apr 21, 2023 · 0 comments
Open

Possible memory leak when receiving #68

fredmaria opened this issue Apr 21, 2023 · 0 comments

Comments

@fredmaria
Copy link

Hi,
I think there may be a memory leak in EsPiLight.
(I'm not an expert developer, so it could well be some kind of user error...)
Here's a minimal code sample illustrating the problem I've encountered:

#include <ESPiLight.h>
#define RECEIVER_PIN 14 // any intterupt able pin
#define TRANSMITTER_PIN -1

ESPiLight rf(TRANSMITTER_PIN);

void rfCallback(const String &protocol, const String &message, int status,
size_t repeats, const String &deviceID)
{
Serial.printf("loop heap size: %u\n", ESP.getFreeHeap());
}

void setup()
{
Serial.begin(115200);
Serial.println("Booting");
rf.setCallback(rfCallback);
rf.initReceiver(RECEIVER_PIN);
}

void loop()
{
rf.loop();
}

And here's the corresponding output:
15:16:55.473 -> loop heap size: 31496
15:17:41.075 -> loop heap size: 31136
15:17:41.174 -> loop heap size: 30776
15:17:41.240 -> loop heap size: 30416

........

15:22:57.536 -> loop heap size: 1256
15:23:33.932 -> loop heap size: 896
15:23:33.999 -> loop heap size: 536
15:23:34.065 -> loop heap size: 176
15:23:34.164 -> Out of memory.
15:23:34.164 -> EXIT: 1

The free heap size is decreasing until the microcontroller crashes.

In my case I'm using a nodemcu esp8266.
I'm using Atom/PlatformIO.

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

No branches or pull requests

1 participant