Skip to content

Fix resizing measurement queue after post by cellular post #319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 14, 2025

Conversation

samuelbles07
Copy link
Collaborator

@samuelbles07 samuelbles07 commented May 14, 2025

Only applied when network option is cellular

Problem

Previously, after processing the vector measurementCycleQueue, we attempted to reduce memory usage by calling .resize() function. The resize() function changes the size of the vector (i.e., the number of elements), not its capacity. If called on an empty vector, it unintentionally fills the vector with default-initialized elements.

Changes

Replace resize by:

  • Swaps the measurementCycleQueue with a fresh one having the desired reserved capacity only if the capacity exceeds the expected capacity.
  • Otherwise, simply clears the vector.

@samuelbles07 samuelbles07 merged commit 09207c6 into develop May 14, 2025
20 checks passed
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.

1 participant