Out of Memory Handler | Blueprints gallery
Blueprints / Out of Memory Handler

Out of Memory Handler

Use Particle's out of memory handler to gracefully handle out of memory conditions and inspect panic codes in device vitals.

Intermediatev1.0.0PublishConsole
Introduction
Supported devices
Hardware and devices
Project description

Introduction

This blueprint shows how to use Particle's out of memory handler to gracefully handle out of memory conditions on device.

Supported devices

Hardware and supplies

  • Any Particle device
  • USB cable

Project description:

This tutorial demonstrates using System.on(out_of_memory, ...) to register a handler when the heap is exhausted. It illustrates high memory usage with a function that allocates 32 KB blocks on the heap until malloc fails, then triggers a panic with the out-of-heap code so the reset reason and panic code appear in device vitals. You'll observe allocation logs on the serial monitor and learn how to interpret the SOS LED and panic code (8) in the Particle Console.

Fork this project to your GitHub account Fork and edit