npm.io
0.10.1 • Published 5 years ago

@dazn/chaos-squirrel-attack-memory

Licence
MIT
Version
0.10.1
Deps
0
Size
8 kB
Vulns
0
Weekly
0
Stars
16
DeprecatedThis package is deprecated

@dazn/chaos-squirrel-attack-memory

Chaos Squirrel attack to fill memory instantly, or increasing memory usage over time.

Usage

Basic memory attack.

import MemoryAttack from '@dazn/chaos-squirrel-attack-memory';

const createMemoryAttack = MemoryAttack.configure({
  size: 2e9 // ~2gb
});

const memoryAttack = createMemoryAttack();
memoryAttack.start();

// ~2gb of memory will be used

memoryAttack.stop(); // removes references to memory to allow GC to collect it

Progressive memory attack.

import MemoryAttack from '@dazn/chaos-squirrel-attack-memory';

const createMemoryAttack = MemoryAttack.configure({
  size: 2e9, // ~2gb
  stepSize: 2e8, // ~200mb
  stepTime: 1e3 // 1s
});

const memoryAttack = createMemoryAttack();
memoryAttack.start();

// ~2gb of memory will be used, starting from 0gb & increasing by ~200mb every 1s

memoryAttack.stop(); // removes references to memory to allow GC to collect it