// MIT License - Copyright (c) 2026 wallstop
// Full license text: https://github.com/wallstop/unity-helpers/blob/main/LICENSE
namespace WallstopStudios.UnityHelpers.Utils
{
///
/// Represents the current level of memory pressure detected by the .
/// Higher levels indicate greater memory stress and trigger more aggressive pool purging.
///
///
///
/// Memory pressure is determined by analyzing:
///
/// - Absolute memory usage compared to
/// - GC collection frequency (rapid collections indicate memory stress)
/// - Memory growth rate between checks
///
///
///
/// Purge behavior at each level:
///
/// - : Normal purging (respects hysteresis, buffer multiplier, warm retain count)
/// - : Reduces buffer multiplier to 1.5x
/// - : Reduces buffer multiplier to 1.0x, ignores warm retain count
/// - : Ignores hysteresis, purges to min retain count
/// - : Emergency purge - purges everything to min retain count immediately
///
///
///
public enum MemoryPressureLevel
{
///
/// No memory pressure detected. Normal purging behavior applies.
/// Pools respect hysteresis, buffer multiplier, and warm retain count.
///
// None is intentionally not [Obsolete] as it represents a valid state (no memory pressure)
None = 0,
///
/// Low memory pressure - approaching the configured threshold.
/// Reduces buffer multiplier to 1.5x to start freeing memory conservatively.
///
Low = 1,
///
/// Medium memory pressure - at or near the configured threshold.
/// Reduces buffer multiplier to 1.0x and ignores warm retain count.
///
Medium = 2,
///
/// High memory pressure - exceeding the configured threshold.
/// Ignores hysteresis protection and purges to min retain count.
///
High = 3,
///
/// Critical memory pressure - emergency situation.
/// Triggers immediate purge of all pools to min retain count, bypassing all protections.
///
Critical = 4,
}
}