Closed
Conversation
Use inline functions to keep from repeating code Added a unit test to confirm functions behave as expected fix 2 (minor) bugs
philj404
commented
Jun 5, 2021
| uint8_t *p = (__brkval == 0 ? (uint8_t *) &__heap_start : __brkval); | ||
|
|
||
| while (*p == STACK_CANARY && (int) p <= SP) | ||
| while (*p == STACK_CANARY && p <= (uint8_t *) SP) |
Owner
Author
There was a problem hiding this comment.
fixes a type conversion warning. Probably harmless but distracting
philj404
commented
Jun 5, 2021
| // | ||
| // Memory addresses | ||
| // | ||
| namespace MU { |
Owner
Author
There was a problem hiding this comment.
New namespace "MU". It may not really be necessary, but I thought the library might be heading in that direction with mu_StackCount() and mu_stack_size. I left those alone to ensure these changes are backwards-compatible.
philj404
commented
Jun 5, 2021
| // | ||
| #include <MemoryUsage.h> | ||
|
|
||
| #include <AUnit.h> |
Owner
Author
There was a problem hiding this comment.
Note this new MemoryUsageTest.ino sketch depends on the AUnit library as well as MemoryUsage. Only this sketch's tests need AUnit. Legacy code should still work fine.
Owner
Author
|
Oops. This pull request is for merging to |
This file contains hidden or 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
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.
This is for a backwards-compatible enhancement to the MemoryUsage library.
At this time MemoryUsage is basically a set of macros to collect usage information as text through Serial.print().
I would like to have more direct access to the numerical values. This gives me more flexibility in using the values. With these changes:
(__brkval == 0 ? (int)&__heap_start : (int)__brkval)to get heap end) is gathered into single (inline) functions. This helps ensure all code using that value will calculate it the same way.This pull request includes Locoduino#4 , so if you want both PRs, you only need to review/approve this one.