MemoryManager
in package
Table of Contents
- $checkRate : int
- $checkTicker : int
- $continuousTrigger : bool
- $continuousTriggerCount : int
- $continuousTriggerRate : int
- $continuousTriggerTicker : int
- $dumpWorkers : bool
- $garbageCollectionAsync : bool
- $garbageCollectionPeriod : int
- $garbageCollectionTicker : int
- $garbageCollectionTrigger : bool
- $globalMemoryLimit : int
- $logger : Logger
- $lowMemChunkGC : bool
- $lowMemChunkRadiusOverride : int
- $lowMemClearWorldCache : bool
- $lowMemDisableChunkCache : bool
- $lowMemory : bool
- $memoryLimit : int
- $server : Server
- __construct() : mixed
- canUseChunkCache() : bool
- check() : void
- Called every tick to update the memory manager state.
- dumpMemory() : void
- Static memory dumper accessible from any thread.
- dumpServerMemory() : void
- Dumps the server memory into the specified output folder.
- getGlobalMemoryLimit() : int
- getViewDistance() : int
- Returns the allowed chunk radius based on the current memory usage.
- isLowMemory() : bool
- trigger() : void
- Triggers garbage collection and cache cleanup to try and free memory.
- triggerGarbageCollector() : int
- continueDump() : mixed
- init() : void
Properties
$checkRate
private
int
$checkRate
$checkTicker
private
int
$checkTicker
= 0
$continuousTrigger
private
bool
$continuousTrigger
= true
$continuousTriggerCount
private
int
$continuousTriggerCount
= 0
$continuousTriggerRate
private
int
$continuousTriggerRate
$continuousTriggerTicker
private
int
$continuousTriggerTicker
= 0
$dumpWorkers
private
bool
$dumpWorkers
= true
$garbageCollectionAsync
private
bool
$garbageCollectionAsync
$garbageCollectionPeriod
private
int
$garbageCollectionPeriod
$garbageCollectionTicker
private
int
$garbageCollectionTicker
= 0
$garbageCollectionTrigger
private
bool
$garbageCollectionTrigger
$globalMemoryLimit
private
int
$globalMemoryLimit
$logger
private
Logger
$logger
$lowMemChunkGC
private
bool
$lowMemChunkGC
$lowMemChunkRadiusOverride
private
int
$lowMemChunkRadiusOverride
$lowMemClearWorldCache
private
bool
$lowMemClearWorldCache
$lowMemDisableChunkCache
private
bool
$lowMemDisableChunkCache
$lowMemory
private
bool
$lowMemory
= false
$memoryLimit
private
int
$memoryLimit
$server
private
Server
$server
Methods
__construct()
public
__construct(Server $server) : mixed
Parameters
- $server : Server
Return values
mixed —canUseChunkCache()
public
canUseChunkCache() : bool
Return values
bool —check()
Called every tick to update the memory manager state.
public
check() : void
Return values
void —dumpMemory()
Static memory dumper accessible from any thread.
public
static dumpMemory(mixed $startingObject, string $outputFolder, int $maxNesting, int $maxStringSize, Logger $logger) : void
Parameters
- $startingObject : mixed
- $outputFolder : string
- $maxNesting : int
- $maxStringSize : int
- $logger : Logger
Return values
void —dumpServerMemory()
Dumps the server memory into the specified output folder.
public
dumpServerMemory(string $outputFolder, int $maxNesting, int $maxStringSize) : void
Parameters
- $outputFolder : string
- $maxNesting : int
- $maxStringSize : int
Return values
void —getGlobalMemoryLimit()
public
getGlobalMemoryLimit() : int
Return values
int —getViewDistance()
Returns the allowed chunk radius based on the current memory usage.
public
getViewDistance(int $distance) : int
Parameters
- $distance : int
Return values
int —isLowMemory()
public
isLowMemory() : bool
Return values
bool —trigger()
Triggers garbage collection and cache cleanup to try and free memory.
public
trigger(int $memory, int $limit[, bool $global = false ][, int $triggerCount = 0 ]) : void
Parameters
- $memory : int
- $limit : int
- $global : bool = false
- $triggerCount : int = 0
Return values
void —triggerGarbageCollector()
public
triggerGarbageCollector() : int
Return values
int —continueDump()
private
static continueDump(mixed $from, array<string|int, object> &$objects, array<string|int, int> &$refCounts, int $recursion, int $maxNesting, int $maxStringSize) : mixed
Parameters
- $from : mixed
- $objects : array<string|int, object>
-
reference parameter
- $refCounts : array<string|int, int>
-
reference parameter
- $recursion : int
- $maxNesting : int
- $maxStringSize : int
Return values
mixed —init()
private
init(ServerConfigGroup $config) : void
Parameters
- $config : ServerConfigGroup