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

using new (std::nothrow) instead of malloc #6251

Merged
merged 1 commit into from
Jul 4, 2019
Merged

Conversation

d-a-v
Copy link
Collaborator

@d-a-v d-a-v commented Jul 3, 2019

No description provided.

@d-a-v d-a-v requested a review from devyte July 3, 2019 20:13
@devyte devyte merged commit 3f35506 into esp8266:master Jul 4, 2019
@mcspr
Copy link
Collaborator

mcspr commented Jul 7, 2019

OT: Should this be documented? I only recently discovered that espasyncwebserver doing some = new ... ; if (some) is not the same thing as basic malloc on current Core; Not used updated toolchain very much because of platformio shipping the old one for so long
Might also be surprising for Arduino in general:

@d-a-v
Copy link
Collaborator Author

d-a-v commented Jul 7, 2019

It is useless when exceptions are disabled in the toolchain.
But we have them as an option.

edit: our new is std c++'s one, not a malloc wrapper

@d-a-v d-a-v deleted the nothrow branch July 7, 2019 10:29
@mcspr
Copy link
Collaborator

mcspr commented Jul 7, 2019

Yes, but my main question is about the null check routines. It does not trigger exception, but board reset still happens when internal malloc fails in low memory situations.

async web server being the case where there are flow objects are constructed with new and checked for NULL afterwards. which spectacularly fails with 4KB-large context:sys stack trace

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 this pull request may close these issues.

3 participants