-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[zephyr] Allow to override default malloc with sys_heap #16926
Merged
Damian-Nordic
merged 7 commits into
project-chip:master
from
Damian-Nordic:sysheap-malloc
Apr 4, 2022
Merged
[zephyr] Allow to override default malloc with sys_heap #16926
Damian-Nordic
merged 7 commits into
project-chip:master
from
Damian-Nordic:sysheap-malloc
Apr 4, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PR #16926: Size comparison from 2758435 to bf59a82 Increases (10 builds for nrfconnect, telink)
Full report (28 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, mbed, nrfconnect, p6, telink)
|
tcarmelveilleux
approved these changes
Apr 1, 2022
woody-apple
approved these changes
Apr 1, 2022
woody-apple
approved these changes
Apr 1, 2022
msandstedt
approved these changes
Apr 1, 2022
Add a setting that overrides default malloc/calloc/realloc/ free functions with custom implementations based on sys_heap from Zephyr RTOS. Update DiagnosticDataProvider methods for obtaining the heap statistics to use the sys_heap statistics when sys_heap-baed malloc is used. Additionally, fix the DiagnosticDataProvider implementation using mallinfo() by taking the maximum heap size into account.
bf59a82
to
ba8b7ec
Compare
PR #16926: Size comparison from 41a431d to ba8b7ec Increases (10 builds for nrfconnect, telink)
Full report (30 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
PR #16926: Size comparison from 41a431d to 91d97b3 Increases (10 builds for nrfconnect, telink)
Full report (30 builds for cc13x2_26x2, cyw30739, efr32, esp32, k32w, linux, mbed, nrfconnect, p6, telink)
|
chencheung
pushed a commit
to chencheung/connectedhomeip
that referenced
this pull request
Apr 6, 2022
…#16926) * [zephyr] Allow to override default malloc with sys_heap Add a setting that overrides default malloc/calloc/realloc/ free functions with custom implementations based on sys_heap from Zephyr RTOS. Update DiagnosticDataProvider methods for obtaining the heap statistics to use the sys_heap statistics when sys_heap-baed malloc is used. Additionally, fix the DiagnosticDataProvider implementation using mallinfo() by taking the maximum heap size into account. * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Handle mul overflow * Add separate switch for wrapping malloc/calloc/realloc/free symbols * Restyled by gn Co-authored-by: Restyled.io <[email protected]>
chencheung
pushed a commit
to chencheung/connectedhomeip
that referenced
this pull request
Apr 6, 2022
…#16926) * [zephyr] Allow to override default malloc with sys_heap Add a setting that overrides default malloc/calloc/realloc/ free functions with custom implementations based on sys_heap from Zephyr RTOS. Update DiagnosticDataProvider methods for obtaining the heap statistics to use the sys_heap statistics when sys_heap-baed malloc is used. Additionally, fix the DiagnosticDataProvider implementation using mallinfo() by taking the maximum heap size into account. * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Handle mul overflow * Add separate switch for wrapping malloc/calloc/realloc/free symbols * Restyled by gn Co-authored-by: Restyled.io <[email protected]>
andrei-menzopol
pushed a commit
to andrei-menzopol/connectedhomeip
that referenced
this pull request
Apr 14, 2022
…#16926) * [zephyr] Allow to override default malloc with sys_heap Add a setting that overrides default malloc/calloc/realloc/ free functions with custom implementations based on sys_heap from Zephyr RTOS. Update DiagnosticDataProvider methods for obtaining the heap statistics to use the sys_heap statistics when sys_heap-baed malloc is used. Additionally, fix the DiagnosticDataProvider implementation using mallinfo() by taking the maximum heap size into account. * Restyled by whitespace * Restyled by clang-format * Restyled by gn * Handle mul overflow * Add separate switch for wrapping malloc/calloc/realloc/free symbols * Restyled by gn Co-authored-by: Restyled.io <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Implementing Software Diagnostics
CurrentHeapHighWatermark
andResetWatermars
on Zephyr platforms requires using a custom malloc implementation since the libc provided one doesn't expose such statistics.Change overview
Add a setting that overrides default malloc/calloc/realloc/free functions with custom implementations based on
sys_heap
from Zephyr RTOS.Update DiagnosticDataProvider methods for obtaining the heap statistics to use the sys_heap statistics when
sys_heap
-based malloc is used (CurrentHeapHighWatermark
requires some further changes in Zephyr, but it is to be added soon).Additionally, fix the DiagnosticDataProvider implementation using
mallinfo()
by taking the maximum heap size into account.Testing
Tested that nRF Connect applications operate normally after switching to the custom malloc.