pw_allocator: Add Pool

This CL adds a slab allocator called `TypedPool`, which can allocate
a specific object type with very low overhead.

To achieve this, it first introduces a new interface, `Pool`, which
differs from `Allocator` in that it only provides memory of a fixed
layout. Common behaviors between `Pool` and `Allocator` have been
promoted to a new base class, `Deallocator`.

With these types in place, the slab allocator simply wraps a pool of
fixed size chunks to provide fast and convenient object creation.

Change-Id: I0d1bf777a6f2e3b3fc9ac59a826196cc5ccd5adb
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/195540
Reviewed-by: Taylor Cramer <cramertj@google.com>
Commit-Queue: Aaron Green <aarongreen@google.com>
23 files changed
tree: 5720144ea5f05271370ceab1ecb0744b9bd3db19
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. kudzu/
  7. pw_alignment/
  8. pw_allocator/
  9. pw_analog/
  10. pw_android_toolchain/
  11. pw_arduino_build/
  12. pw_assert/
  13. pw_assert_basic/
  14. pw_assert_log/
  15. pw_assert_tokenized/
  16. pw_assert_zephyr/
  17. pw_async/
  18. pw_async2/
  19. pw_async2_basic/
  20. pw_async2_epoll/
  21. pw_async_basic/
  22. pw_base64/
  23. pw_bloat/
  24. pw_blob_store/
  25. pw_bluetooth/
  26. pw_bluetooth_hci/
  27. pw_bluetooth_profiles/
  28. pw_bluetooth_proxy/
  29. pw_bluetooth_sapphire/
  30. pw_boot/
  31. pw_boot_cortex_m/
  32. pw_build/
  33. pw_build_android/
  34. pw_build_info/
  35. pw_build_mcuxpresso/
  36. pw_bytes/
  37. pw_channel/
  38. pw_checksum/
  39. pw_chre/
  40. pw_chrono/
  41. pw_chrono_embos/
  42. pw_chrono_freertos/
  43. pw_chrono_rp2040/
  44. pw_chrono_stl/
  45. pw_chrono_threadx/
  46. pw_chrono_zephyr/
  47. pw_cli/
  48. pw_compilation_testing/
  49. pw_config_loader/
  50. pw_console/
  51. pw_containers/
  52. pw_cpu_exception/
  53. pw_cpu_exception_cortex_m/
  54. pw_crypto/
  55. pw_digital_io/
  56. pw_digital_io_linux/
  57. pw_digital_io_mcuxpresso/
  58. pw_digital_io_rp2040/
  59. pw_docgen/
  60. pw_doctor/
  61. pw_emu/
  62. pw_env_setup/
  63. pw_env_setup_zephyr/
  64. pw_file/
  65. pw_format/
  66. pw_function/
  67. pw_fuzzer/
  68. pw_grpc/
  69. pw_hdlc/
  70. pw_hex_dump/
  71. pw_i2c/
  72. pw_i2c_linux/
  73. pw_i2c_mcuxpresso/
  74. pw_i2c_rp2040/
  75. pw_ide/
  76. pw_interrupt/
  77. pw_interrupt_cortex_m/
  78. pw_interrupt_xtensa/
  79. pw_interrupt_zephyr/
  80. pw_intrusive_ptr/
  81. pw_json/
  82. pw_kvs/
  83. pw_libc/
  84. pw_libcxx/
  85. pw_log/
  86. pw_log_android/
  87. pw_log_basic/
  88. pw_log_null/
  89. pw_log_rpc/
  90. pw_log_string/
  91. pw_log_tokenized/
  92. pw_log_zephyr/
  93. pw_malloc/
  94. pw_malloc_freelist/
  95. pw_malloc_freertos/
  96. pw_metric/
  97. pw_minimal_cpp_stdlib/
  98. pw_module/
  99. pw_multibuf/
  100. pw_multisink/
  101. pw_package/
  102. pw_perf_test/
  103. pw_persistent_ram/
  104. pw_polyfill/
  105. pw_preprocessor/
  106. pw_presubmit/
  107. pw_protobuf/
  108. pw_protobuf_compiler/
  109. pw_random/
  110. pw_result/
  111. pw_ring_buffer/
  112. pw_router/
  113. pw_rpc/
  114. pw_rpc_transport/
  115. pw_rust/
  116. pw_sensor/
  117. pw_snapshot/
  118. pw_software_update/
  119. pw_span/
  120. pw_spi/
  121. pw_spi_linux/
  122. pw_spi_mcuxpresso/
  123. pw_spi_rp2040/
  124. pw_status/
  125. pw_stm32cube_build/
  126. pw_stream/
  127. pw_stream_shmem_mcuxpresso/
  128. pw_stream_uart_linux/
  129. pw_stream_uart_mcuxpresso/
  130. pw_string/
  131. pw_symbolizer/
  132. pw_sync/
  133. pw_sync_baremetal/
  134. pw_sync_embos/
  135. pw_sync_freertos/
  136. pw_sync_stl/
  137. pw_sync_threadx/
  138. pw_sync_zephyr/
  139. pw_sys_io/
  140. pw_sys_io_ambiq_sdk/
  141. pw_sys_io_arduino/
  142. pw_sys_io_baremetal_lm3s6965evb/
  143. pw_sys_io_baremetal_stm32f429/
  144. pw_sys_io_emcraft_sf2/
  145. pw_sys_io_mcuxpresso/
  146. pw_sys_io_rp2040/
  147. pw_sys_io_stdio/
  148. pw_sys_io_stm32cube/
  149. pw_sys_io_zephyr/
  150. pw_system/
  151. pw_target_runner/
  152. pw_thread/
  153. pw_thread_embos/
  154. pw_thread_freertos/
  155. pw_thread_stl/
  156. pw_thread_threadx/
  157. pw_thread_zephyr/
  158. pw_tls_client/
  159. pw_tls_client_boringssl/
  160. pw_tls_client_mbedtls/
  161. pw_tokenizer/
  162. pw_toolchain/
  163. pw_toolchain_bazel/
  164. pw_trace/
  165. pw_trace_tokenized/
  166. pw_transfer/
  167. pw_uart/
  168. pw_unit_test/
  169. pw_unit_test_zephyr/
  170. pw_varint/
  171. pw_watch/
  172. pw_web/
  173. pw_work_queue/
  174. seed/
  175. targets/
  176. third_party/
  177. ts/
  178. zephyr/
  179. .bazelignore
  180. .bazelrc
  181. .black.toml
  182. .clang-format
  183. .clang-tidy
  184. .eslintrc.cjs
  185. .git-blame-ignore-revs
  186. .gitattributes
  187. .gitignore
  188. .gn
  189. .mypy.ini
  190. .prettierignore
  191. .prettierrc.cjs
  192. .pw_ide.yaml
  193. .pylintrc
  194. activate.bat
  195. Android.bp
  196. AUTHORS
  197. bootstrap.bat
  198. bootstrap.sh
  199. BUILD.bazel
  200. BUILD.gn
  201. BUILDCONFIG.gn
  202. CMakeLists.txt
  203. jest.config.ts
  204. Kconfig.zephyr
  205. LICENSE
  206. modules.gni
  207. OWNERS
  208. package-lock.json
  209. package.json
  210. pigweed.json
  211. PIGWEED_MODULES
  212. README.md
  213. rollup.config.js
  214. tsconfig.json
  215. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links