<?php
/*
Plugin Name: A plugin that uses a lot of memory while loading
Plugin URI: http://localhost/
Description: Uses a lot of memory while the plugin loads
Author: mattr
Version: 1.0
*/

define('WASTE_MEMORY_MB', 119);
//define('WASTE_MEMORY_MB', 55);


function waste_memory() { 
	error_log('Current memory usage: ' . memory_get_usage());
	error_log('  Allocating memory: ' . WASTE_MEMORY_MB . 'MB');

	// 8 bytes x 128 x 1024 = 1 MB, multiplied by the constant
	$_SERVER['wasted_memory'] = str_repeat('12345678', 128 * 1024 * WASTE_MEMORY_MB);

	error_log('  Memory after allocation: ' . memory_get_usage());
}

// Use up some memory now, while loading plugins
waste_memory();
