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

asyncmqttclient corrupts memory on connect #275

Open
dmelgar opened this issue Dec 27, 2021 · 0 comments
Open

asyncmqttclient corrupts memory on connect #275

dmelgar opened this issue Dec 27, 2021 · 0 comments

Comments

@dmelgar
Copy link

dmelgar commented Dec 27, 2021

I have found very disturbing behavior. I've been able to narrow the issue down to the following. This is with ESP8266. Using version 0.9.0 of AsyncMqttClient.

Essentially the code is of the form,

main.cpp

Class1 a = Class1();
AsyncMqttClient b = AsyncMqttClient();

....
void onWifiConnect(...) {
  b.connect();
}

The crazy behavior I'm observing is that the address of a changes after MQTT connects.
It looks like AsyncMqttClient is corrupting the data segment.
I changed to allocate AsyncMqttClient off the heap instead and a is no longer being corrupted, but I don't have confidence that its not just corrupting something else.
ie,
AsyncMqttClient *b = AsyncMqttClient()

Is this known behavior? Is there a preferred way to allocate/construct AsyncMqttClient?

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