Skip to content

feat: memory debug logs#120

Merged
mattrossman merged 6 commits intomainfrom
feat/memory-observability
Apr 3, 2026
Merged

feat: memory debug logs#120
mattrossman merged 6 commits intomainfrom
feat/memory-observability

Conversation

@mattrossman
Copy link
Copy Markdown
Owner

@mattrossman mattrossman commented Apr 2, 2026

  • Adds dev-only heap probes around startup, AppMessage, layer setup, and forecast redraws.
  • Logs forecast payload size plus redraw low-watermark samples for allocator churn debugging.
  • Compiles the logging out of release builds and documents the helper in AGENTS.md.

Related: #119

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds dev-only heap observability to help debug Aplite memory pressure (Issue #119) by instrumenting heap snapshots and low-watermark sampling around startup, AppMessage handling, layer lifecycle, and forecast redraws.

Changes:

  • Add a memory_log.h helper with dev-only macros for heap snapshots and scoped low-watermark probes.
  • Sprinkle heap probes across watchface init/teardown, window/layer create/destroy, AppMessage receive/open, and forecast redraw/refresh.
  • Enable the feature in dev builds via a build flag set from the generated package profile, and document usage in AGENTS.md.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
wscript Reads build profile and injects FCW2_ENABLE_MEMORY_LOGGING CFLAG for dev builds.
src/c/appendix/memory_log.h Introduces MEMORY_LOG_HEAP and heap probe macros (dev-only).
src/c/watchface.c Adds heap snapshots around boot/init and teardown.
src/c/windows/main_window.c Adds heap snapshots after load and around unload.
src/c/appendix/app_message.c Logs forecast payload size and heap after app_message_open().
src/c/appendix/config.c Logs heap after config load/refresh.
src/c/layers/forecast_layer.c Adds redraw low-watermark sampling and refresh-size heap logging.
src/c/layers/weather_status_layer.c Adds heap snapshots around update/create/refresh/destroy.
src/c/layers/time_layer.c Adds heap snapshots after create and around destroy.
src/c/layers/loading_layer.c Adds heap snapshots after create and around destroy.
src/c/layers/calendar_layer.c Adds heap snapshots after create and around destroy.
src/c/layers/calendar_status_layer.c Adds heap snapshots after create and around destroy.
src/c/layers/battery_layer.c Adds heap snapshots after create and around destroy.
AGENTS.md Documents how to use the heap probe macros.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mattrossman mattrossman marked this pull request as ready for review April 3, 2026 04:03
@mattrossman mattrossman changed the title feat: add memory observability feat: memory debug logs Apr 3, 2026
@mattrossman mattrossman merged commit c884c6d into main Apr 3, 2026
2 checks passed
@mattrossman mattrossman deleted the feat/memory-observability branch April 3, 2026 04:03
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