Skip to content

Memory pool#1283

Open
n1LS wants to merge 9 commits intoxiphonics:masterfrom
n1LS:memory-pool
Open

Memory pool#1283
n1LS wants to merge 9 commits intoxiphonics:masterfrom
n1LS:memory-pool

Conversation

@n1LS
Copy link
Copy Markdown
Contributor

@n1LS n1LS commented Feb 19, 2026

Before:

FLASH:      714524 B         2 MB     34.07%
  RAM:      233704 B       256 KB     89.15%

After:

FLASH:      713948 B         2 MB     34.04%
  RAM:      230328 B       256 KB     87.86%

@n1LS
Copy link
Copy Markdown
Contributor Author

n1LS commented Feb 19, 2026

Implements #1284

@maks
Copy link
Copy Markdown
Collaborator

maks commented Feb 20, 2026

@n1LS thanks for working on this!
As a starting point could you add some explanation of what you have done here. Is this only for consolidating existing file index lists or does it go further than that, etc

@n1LS n1LS mentioned this pull request Feb 20, 2026
@n1LS
Copy link
Copy Markdown
Contributor Author

n1LS commented Mar 2, 2026

@maks Sorry, I missed you message.

This pr implements pretty much exactly what's described in the issue:

  1. It adds a MemoryPool implementation that shares a 1kB RAM buffer, that is freely available for short-term use. A few parts of the firmware had local buffers that were deemed to big to be heap allocated, but only used rarely (as string buffers) etc. I removed those statically allocated buffers and some heap allocations of the same sort.
  2. The shared memory is protected via the Acquire() and Release() functions, leading to visual warnings in DEBUG builds, when an access occurs on the locked buffer.
  3. I unified the various etl::vector<int, MAX_FILE_INDEX_SIZE> fileIndexList across all views to use a static one provided by the MemoryPool.

Next steps:

This already improves RAM usage by 3.376 Bytes (1.3%) and there's still a few static memorty allocartions that could be moved to the MemoryPool. Those should be identified and updated.

@maks maks requested review from democloid and maks March 2, 2026 09:23
Copy link
Copy Markdown
Collaborator

@maks maks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for working on this @n1LS . I left some feedback and also this needs to be brought up to date with master branch.

Comment thread sources/Application/Utils/MemoryPool.cpp Outdated
Comment thread sources/Application/Utils/MemoryPool.cpp Outdated
Comment thread sources/Application/Utils/MemoryPool.h Outdated
Comment thread sources/Application/AppWindow.cpp
Comment thread sources/Application/AppWindow.h Outdated
Comment thread sources/Adapters/picoTracker/filesystem/picoTrackerFileSystem.cpp Outdated
Comment thread sources/Application/Utils/MemoryPool.cpp Outdated
@n1LS
Copy link
Copy Markdown
Contributor Author

n1LS commented Mar 9, 2026

@maks I added mutexes to prevent multiple access via scoped locks, which are held/release with the scope of the buffer/fileIndexList received

@maks maks added this to the 2.4 milestone Mar 12, 2026
@maks
Copy link
Copy Markdown
Collaborator

maks commented Mar 20, 2026

@n1LS can you please resolve merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants