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

Specify MALLOC_CAP_INTERNAL while calloc()ing heap #61

Closed
SmittyHalibut opened this issue Feb 27, 2023 · 4 comments
Closed

Specify MALLOC_CAP_INTERNAL while calloc()ing heap #61

SmittyHalibut opened this issue Feb 27, 2023 · 4 comments

Comments

@SmittyHalibut
Copy link
Contributor

https://github.com/NorthernMan54/rtl_433_ESP/blob/master/src/rtl_433_ESP.cpp#L409

I was getting calloc() failures, even though there was enough heap reported by ESP.getFreeHeap() and ESP.getMaxAllocHeap().

Those two reporting tools however are calling heap_caps_ functions, and hard coding a capability of MALLOC_CAP_INTERNAL to force reporting heap for Internal memory only.

I tested by detecting a calloc(...) failure, then trying a heap_cap_calloc(..., MALLOC_CAP_INTERNAL) which always succeeded.

So I propose replacing calloc(..) with heap_caps_calloc(..., MALLOC_CAP_INTERNAL)

Pull request incoming. :-)

@NorthernMan54
Copy link
Owner

For this issue, any thoughts on how I could recreate it? During testing I never ran into this.

I won’t be able to merge this for a few weeks, as I’m out of the country, and don’t have access to my test environment

@SmittyHalibut
Copy link
Contributor Author

It came up for me when I enabled both ZgatewayBT and ZgatewayRTL_433 at the same time in OpenMQTTGateway. I suspect that BT is also using an inspecific malloc() scheme and it's defaulting to something other than INTERNAL that's smaller than INTERNAL.

@SmittyHalibut
Copy link
Contributor Author

Its not confirmed yet, but 1technophile/OpenMQTTGateway#1529 MIGHT be the same problem I was running into yet. Their reported symptoms sound similar, after doing the same thing I did. Soooo, maybe chances are good that ticket is reproduction?

@NorthernMan54
Copy link
Owner

This has been implemented

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

2 participants