datadog-ux-utils Documentation - v1.0.0
    Preparing search index...

    Function startMemoryPeakTracking

    • Start lightweight peak-memory tracking.

      • If performance.memory is unavailable, this becomes a no-op (safe).
      • In "onHide" mode, the tracker reports at most once per page lifetime.
      • In "interval" mode, it reports at a low frequency (use conservatively).
      • In "manual" mode, you can call reportMemoryPeak() whenever you like.

      Parameters

      Returns () => void

        • (): void
        • Stop tracking and remove listeners. Does not clear the last observed peak.

          Returns void

      import { startMemoryPeakTracking } from "datadog-ux-utils/memoryPeak";

      // Default: records peaks and reports once when the tab hides/unloads
      const stop = startMemoryPeakTracking();

      // Clean up later (SPA teardown)
      stop();
      // Interval mode (report every 2 minutes)
      startMemoryPeakTracking({ mode: "interval", intervalMs: 120_000 });