-
Notifications
You must be signed in to change notification settings - Fork 3k
mem pool size: Fix calculation of memory pool size for portability #10706
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
mem pool size: Fix calculation of memory pool size for portability #10706
Conversation
@@ -184,13 +184,11 @@ class MemoryPool : private mbed::NonCopyable<MemoryPool<T, pool_sz> > { | |||
private: | |||
osMemoryPoolId_t _id; | |||
/* osMemoryPoolNew requires that pool block size is a multiple of 4 bytes. */ | |||
char _pool_mem[((sizeof(T) + 3) & ~3) * pool_sz]; | |||
char _pool_mem[MBED_RTOS_STORAGE_MEM_POOL_MEM_SIZE(pool_sz, sizeof(T))]; |
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.
The change leaves the comment above unnecessary.
I do worry a bit about alignment, but maybe some C++11 alignas
qualifier(s) could be added later.
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.
@hugueskamba, thank you for your changes. |
@hugueskamba could we rename the commit ? 'TO BE SQUASHED' is not really that meaningful. |
@adbridge It is an indication that the commit should be squashed and only the first commit should remain. There is no point in having two commits for this work as the second commit just removes the comment which should have been done when the first commit was made. In my previous team we were using a squash and merge strategy. The merger would squash all commits marked for squashed at the point of merging. Do you have something similar as it will be pointless to have both commits instead of just one? |
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.
Generally we expect committers to do their own squashing and tidying with one or more force pushes before finalisation - maintainers will do a rebase and merge of the commits in the PR as-is.
Ah I see. Force pushes were frowned upon in my previous team. Ok I will tidy it up. |
Replace the hardcoded value calculation of the memory pool block size with the RTX preprocessor macro (via a shim layer). This is in preparation for the replacement of the direct access of RTX functionalities in Mbed OS with an access via CMSIS.
e621e81
to
4f8305e
Compare
CI started |
Test run: FAILEDSummary: 6 of 7 test jobs failed Failed test jobs:
|
CI restarted |
Test run: FAILEDSummary: 6 of 7 test jobs failed Failed test jobs:
|
Aborted the job unfortunately as we have to reschedule one possibly rc4 PR. |
Ci started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
Replace the hardcoded value calculation of the memory pool block size
with the RTX preprocessor macro (via a shim layer).
This is in preparation for the replacement of the direct access of RTX
functionalities in Mbed OS with an access via CMSIS.
Pull request type
Reviewers
@0xc0170
fixes: #9119