-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Ensure xPortGetFreeHeapSize reports DRAM #8680
Conversation
Create dedicated function for `xPortGetFreeHeapSize()` that only reports on DRAM. Update and export `umm_free_heap_size()` to report the free Heap space of the current Heap. Updated ESP.getFreeHeap() to use. Replace internal function `umm_free_heap_size_lw()` with `umm_free_heap_size()`. See umm_malloc/Notes.h entry Sep 26, 2022 for more specifics. uncrustified `umm_poison.c`
Why not 'alias' for both variants? Specifically, function name change in _info.c where we have it either be |
@mcspr Okay, I have made some changes I'll push them tomorrow after I review them again. I did some build option variations and found some issues. Another function needs to be broken out. Also, improved support for comment block build options. |
While touching and regression testing of build macros for umm_info... and umm_stats..., improved/fixed macros for better support of build options specified through Sketch.ino.globals.h.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran a couple of tests switching build opts, everything works as described.
Only (minor?) issue is we still could make getHeapStats
do nothing when umm
info / stats become empty macro calls. This was already happening before the PR, though.
@mcspr what do you think it should do? The only info I could return would be free heap size; however, |
Fail on link, since we have a clear dependency? Empty macro inside UMM still makes sense to skip some actions, but external one probably doesn't. If we don't use ESP.getHeapStats, we don't care whether anything related to stats is implemented. |
Improve empty function situation around build option UMM_INFO.
Something about that umm double include does not feel right... cfgport may come either first, or last. Kind of a weird dependency. |
When I make changes I migrate closer to upstream usage where I have more changes for aligning with umm_malloc upstream plus a few enhancements, I now need to work through those and see what I have broken (if any) with this shuffle. I think I am done with this one. It was a lot more change than I wanted for a quick fix. |
Create dedicated function for
xPortGetFreeHeapSize()
that only reports on DRAM.NONOS SDK API
system_get_free_heap_size()
relies onxPortGetFreeHeapSize()
for the free Heap size.Possible breaking change for multiple Heap Sketches calling
system_get_free_heap_size()
; it will now always report free DRAM Heap size.Update and export
umm_free_heap_size_lw()
to report the free Heap size of the current Heap.Updated ESP.getFreeHeap() to use
umm_free_heap_size_lw()
.Updated build options to supply exported
umm_free_heap_size_lw()
via either UMM_STATS or UMM_INFO.Improved build option support via the
SketchName.ino.globals.h
method for Heap options: UMM_INFO, UMM_INLINE_METRICS, UMM_STATS, UMM_STATS_FULL, UMM_BEST_FIT, and UMM_FIRST_FIT. While uncommon to change from the defaults, you can reviewumm_malloc_cfgport.h
for more details, which may help reduce your Sketch's size in dire situations. Assuming you are willing to give up some functionality.For debugging UMM_STATS_FULL can offer additional stats, like Heap low water mark (
umm_free_heap_size_min()
).See
umm_malloc/Notes.h
entry Sep 26, 2022 for overview.uncrustified
umm_poison.c
Edited: revised to track PR changes