GenisysPro  for Minecraft PE/Windows 10 v1.1.x
Feature-rich server software for Minecraft PE and Windows 10 Edition
LowMemoryEvent Class Reference

Public Member Functions

 __construct ($memory, $memoryLimit, $isGlobal=false, $triggerCount=0)
 
 getMemory ()
 
 getMemoryLimit ()
 
 getTriggerCount ()
 
 isGlobal ()
 
 getMemoryFreed ()
 
- Public Member Functions inherited from Event
 getEventName ()
 
 getHandlers ()
 

Static Public Attributes

static $handlerList = null
 

Additional Inherited Members

- Protected Attributes inherited from Event
 $eventName = null
 

Detailed Description

Called when the server is in a low-memory state as defined by the properties Plugins should free caches or other non-essential data.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $memory,
  $memoryLimit,
  $isGlobal = false,
  $triggerCount = 0 
)

LowMemoryEvent constructor.

Parameters
$memory
$memoryLimit
bool$isGlobal
int$triggerCount
47  {
48  $this->memory = $memory;
49  $this->memoryLimit = $memoryLimit;
50  $this->global = (bool) $isGlobal;
51  $this->triggerCount = (int) $triggerCount;
52  }

Member Function Documentation

◆ getMemory()

getMemory ( )

Returns the memory usage at the time of the event call (in bytes)

Returns
int
59  {
60  return $this->memory;
61  }

◆ getMemoryFreed()

getMemoryFreed ( )

Amount of memory already freed

Returns
int
93  {
94  return $this->getMemory() - ($this->isGlobal() ? Utils::getMemoryUsage(true)[1] : Utils::getMemoryUsage(true)[0]);
95  }

◆ getMemoryLimit()

getMemoryLimit ( )

Returns the memory limit defined (in bytes)

Returns
int
68  {
69  return $this->memory;
70  }

◆ getTriggerCount()

getTriggerCount ( )

Returns the times this event has been called in the current low-memory state

Returns
int
77  {
78  return $this->triggerCount;
79  }

◆ isGlobal()

isGlobal ( )
Returns
bool
84  {
85  return $this->global;
86  }

Field Documentation

◆ $handlerList

$handlerList = null
static

The documentation for this class was generated from the following file: