1.. _module-pw_allocator-size-reports: 2 3================== 4Code size analysis 5================== 6.. pigweed-module-subpage:: 7 :name: pw_allocator 8 9This module provides the :ref:`module-pw_allocator-api-allocator` interface, as 10well as several implementations of it. The tables below shows the 11relative code size for the interface and each of these implementations. The 12measurement includes a call to each method. 13 14------------------- 15Allocator interface 16------------------- 17The following shows the code size incurred by the 18:ref:`module-pw_allocator-api-allocator` interface itself. A call to each method 19of the interface is measured using an empty implementation, 20:ref:`module-pw_allocator-api-null_allocator`. 21 22.. include:: allocator_api_size_report 23 24--------------------- 25Block implementations 26--------------------- 27Most of the concrete allocator implementations are block allocators that use 28:ref:`module-pw_allocator-design-blocks` to manage allocations. Code size and 29memory overhead for blocks varies depending on what features are included. 30 31The following are code sizes for the block implementations provided by this 32module. 33 34.. include:: blocks_size_report 35 36Impact of different hardening levels 37==================================== 38This module includes :ref:`module-pw_allocator-config-hardening` which sets 39which validation checks are included. Additional checks can detect more errors 40at the cost of additional code size, as illustrated in the size report below: 41 42.. include:: hardening_size_report 43 44---------------------- 45Bucket implementations 46---------------------- 47Most of the concrete allocator implementations are block allocators that use 48:ref:`module-pw_allocator-design-buckets` to organize blocks that are not in use 49and are available for allocation. 50 51The following are code sizes for the block implementations provided by this 52module. These are measured relative to the container they use, as reusing 53container types may save code size. See :ref:`module-pw_containers` for code 54size information on each container type. 55 56.. include:: buckets_size_report 57 58------------------------------- 59Block allocator implementations 60------------------------------- 61Most of the concrete allocator implementations provided by this module that 62are derived from :ref:`module-pw_allocator-api-block_allocator`. The following 63are code sizes for each of the block allocator implementations, and are measured 64relative to the blocks they use. 65 66.. include:: block_allocators_size_report 67 68---------------------------------------- 69Other concrete allocator implementations 70---------------------------------------- 71The following are code sizes for the other allocator implementations that 72directly manage the memory they use to fulfill requests, but that do not derive 73from :ref:`module-pw_allocator-api-block_allocator`. These are measured relative 74to the empty implementation measured above. 75 76.. include:: concrete_allocators_size_report 77 78------------------------------------- 79Forwarding allocators implementations 80------------------------------------- 81The following are code sizes for each of the provided "forwarding" allocators as 82described by :ref:`module-pw_allocator-design-forwarding`. These are measured 83by having the forwarding allocator wrap a 84:ref:`module-pw_allocator-api-first_fit_allocator`, and are measured relative to 85that implementation. 86 87.. include:: forwarding_allocators_size_report 88