Skip to content

Comments

Refactored Bitmap handler to decrease HEAP usage#375

Merged
JanPetterMG merged 2 commits intomainfrom
bitmap-refactor-std-span
Feb 24, 2026
Merged

Refactored Bitmap handler to decrease HEAP usage#375
JanPetterMG merged 2 commits intomainfrom
bitmap-refactor-std-span

Conversation

@JanPetterMG
Copy link
Contributor

Migrates BitmapHandler away from std::vector by introducing std::array for owned bitmap storage and std::span for non-owning bitmap views. The goal is to reduce dynamic allocations and make bitmap handling more deterministic.

Key changes

  • Replaced std::vector<uint16_t> bitmap storage with std::array<uint16_t, N> where sizes are known
  • Updated BitmapHandler to accept std::span<const uint16_t> for caller-provided bitmaps
  • Reduced copying by passing bitmap data as views instead of owning containers

Impact

  • Less heap usage and fewer allocations/copies
  • Clearer ownership model (array owns, span views)

@JanPetterMG JanPetterMG added firmware C++ related chore This issue or pull request is a maintenance task labels Feb 24, 2026
@JanPetterMG JanPetterMG added this to the v2.3.0 milestone Feb 24, 2026
@github-actions github-actions bot added the extra Optional resources label Feb 24, 2026
@JanPetterMG JanPetterMG marked this pull request as ready for review February 24, 2026 00:28
@JanPetterMG JanPetterMG merged commit 13d4917 into main Feb 24, 2026
152 checks passed
@JanPetterMG JanPetterMG deleted the bitmap-refactor-std-span branch February 24, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore This issue or pull request is a maintenance task extra Optional resources firmware C++ related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant