-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix and test heap allocation of PacketBuffers (#4632)
* Fix and test heap allocation of PacketBuffers #### Problem CHIP has to option to use heap-allocated packet buffers (with `CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE == 0`) but this configuration has been neglected, and CHIP neither builds nor runs in this configuration. #### Summary of Changes Build fixes: - Default `CHIP_CONFIG_RMP_RETRANS_TABLE_SIZE` to 15 for heap case. 15 is the default packet buffer pool size in SystemConfig.h. See also issue #4335 - Our definition of the CRMP retransmission table size does not really make sense Runtime fixes: - Ensure echo server has enough buffer space for the response (and added `CHECK_RETURN_VALUE` to `EnsureReservedSize()`). - Added room for MAC in echo requester. - Added room for MAC in `chipSendUnicast()`. - Added parameters to `CloneData()` to request header and trailing space. - Fixed CHIPMem initialization for some tests. - Fix tests that didn't allocate enough space. Build and code changes to assist memory troubleshooting (these should have no cost unless enabled): - Added a build flag `chip_config_memory_debug_checks` and corresponding preprocessor definition `CHIP_CONFIG_MEMORY_DEBUG_CHECKS` to enable extra memory checks, at a performance cost. In particular, new functions `Platform::MemoryDebugCheckPointer()` and `PacketBufferHandle::Check()` operate when this is enabled. - Added a build flag `chip_config_memory_debug_dmalloc` and corresponding preprocessor definition `CHIP_CONFIG_MEMORY_DEBUG_DMALLOC` to use the dmalloc debugging malloc library. - Clarified conditions for the four configurations of PacketBuffer allocation. - Replaced some PacketBuffer #define constants with scoped constexprs. - Renamed `CHIP_SYSTEM_CONFIG_PACKETBUFFER_MAXALLOC` to `CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE` to remove the ambiguity of what a ‘maximum allocation’ is. Build and automated test changes: - Made standalone builds default to heap allocation. - Run a set of unit tests with dmalloc. fixes #4395 - Heap packet buffer allocation is broken fixes #4390 - ReliableMessageProtocol assumes a buffer pool * review * review 2 * fix messaging shutdown * review 3 * fix tests Co-authored-by: Justin Wood <[email protected]>
- Loading branch information
1 parent
819c1e9
commit 1b6a96b
Showing
43 changed files
with
627 additions
and
345 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.