How to reduce RAM

Asset Tracker Template

tags
Asset Tracker Template
  • Minimize enabled data types

    • Disable modules that you do not forward or store (for example, CONFIG_APP_LOCATION=n), which reduces both slabs and RAM backend ring buffers and shrinks STORAGE_MAX_DATA_SIZE.
  • Reduce records per type

    • Set CONFIG_APP_STORAGE_MAX_RECORDS_PER_TYPE=1 when buffering is not needed. This shrinks both the per-type slabs and RAM ring buffers to a single record each.
  • Shrink batch pipe buffer

    • Set the CONFIG_APP_STORAGE_BATCH_BUFFER_SIZE Kconfig option to a lower value (for example, from 1024 down to 256 bytes), but ensure it can still hold at least one item of sizeof(header) + max_item_size if you use batch mode.
  • Reduce thread and queues

    • Set the CONFIG_APP_STORAGE_THREAD_STACK_SIZE Kconfig option to a lower value (for example, from 2048 down to 1024) if your application leaves headroom.
    • Reduce the relevant zbus queue sizes in the system configuration if traffic allows.
  • Remove development features

    • Disable the CONFIG_APP_STORAGE_SHELL and CONFIG_APP_STORAGE_SHELL_STATS Kconfig option to trim RAM and code footprint.
  • Prefer the LittleFS backend when buffering many records

    • Use the LittleFS backend when a large CONFIG_APP_STORAGE_MAX_RECORDS_PER_TYPE value is needed, because the RAM backend allocates all ring buffers at boot, while the LittleFS backend only uses RAM for the currently stored records.
  • Ready-made Kconfig fragment

    • Use overlay-storage-minimal.conf to apply a minimal storage configuration with reduced RAM usage.