PropertyDamage.Nemesis.MemoryPressure (PropertyDamage v0.2.0)
View SourceCreate memory pressure in the BEAM VM.
Allocates memory to simulate low-memory conditions, useful for testing memory-sensitive code paths, garbage collection behavior, and OOM handling.
Configuration
:megabytes- Amount of memory to allocate (default: 100MB):duration_ms- How long to hold the memory (default: 5000ms):allocation_pattern- How to allocate::bulk,:fragmented(default::bulk)
Warning
This operation actually allocates memory in the BEAM. Use with caution and ensure your test environment has sufficient resources.
Example
def commands do
[
{ProcessData, weight: 5},
{PropertyDamage.Nemesis.MemoryPressure, weight: 1}
]
endTesting Behavior
Under memory pressure, your system should:
- Handle allocation failures gracefully
- Trigger appropriate cleanup/GC
- Maintain functionality with reduced caching