PocketMine-MP 5.15.1 git-5ef247620a7c6301a849b54e5ef1009217729fc8
pocketmine\event\server\LowMemoryEvent Class Reference
+ Inheritance diagram for pocketmine\event\server\LowMemoryEvent:
+ Collaboration diagram for pocketmine\event\server\LowMemoryEvent:

Public Member Functions

 __construct (private int $memory, private int $memoryLimit, private bool $isGlobal=false, private int $triggerCount=0)
 
 call ()
 
 getEventName ()
 
 getMemory ()
 
 getMemoryFreed ()
 
 getMemoryLimit ()
 
 getTriggerCount ()
 
 isGlobal ()
 

Static Public Member Functions

static hasHandlers ()
 

Protected Attributes

string $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.

Definition at line 32 of file LowMemoryEvent.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\event\server\LowMemoryEvent::__construct ( private int  $memory,
private int  $memoryLimit,
private bool  $isGlobal = false,
private int  $triggerCount = 0 
)

Definition at line 33 of file LowMemoryEvent.php.

Member Function Documentation

◆ call()

pocketmine\event\Event::call ( )
inherited

Calls event handlers registered for this event.

Exceptions

RuntimeException if event call recursion reaches the max depth limit

Definition at line 49 of file Event.php.

◆ getEventName()

pocketmine\event\Event::getEventName ( )
finalinherited

Definition at line 40 of file Event.php.

◆ getMemory()

pocketmine\event\server\LowMemoryEvent::getMemory ( )

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

Definition at line 43 of file LowMemoryEvent.php.

◆ getMemoryFreed()

pocketmine\event\server\LowMemoryEvent::getMemoryFreed ( )

Amount of memory already freed

Definition at line 68 of file LowMemoryEvent.php.

◆ getMemoryLimit()

pocketmine\event\server\LowMemoryEvent::getMemoryLimit ( )

Returns the memory limit defined (in bytes)

Definition at line 50 of file LowMemoryEvent.php.

◆ getTriggerCount()

pocketmine\event\server\LowMemoryEvent::getTriggerCount ( )

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

Definition at line 57 of file LowMemoryEvent.php.

◆ hasHandlers()

static pocketmine\event\Event::hasHandlers ( )
staticinherited

Returns whether the current class context has any registered global handlers. This can be used in hot code paths to avoid unnecessary event object creation.

Usage: SomeEventClass::hasHandlers()

Definition at line 77 of file Event.php.

◆ isGlobal()

pocketmine\event\server\LowMemoryEvent::isGlobal ( )

Definition at line 61 of file LowMemoryEvent.php.

Member Data Documentation

◆ $eventName

string pocketmine\event\Event::$eventName = null
protectedinherited

Definition at line 38 of file Event.php.


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