mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Fixed a microscopic Command TimingsHandler memory leak
This reduces memory usage of an idling server by about 20kb. Definitely worth the time.
This commit is contained in:
parent
1266f8f1aa
commit
de359a2bce
@ -79,11 +79,11 @@ abstract class Command{
|
||||
*/
|
||||
public function __construct($name, $description = "", $usageMessage = null, array $aliases = []){
|
||||
$this->commandData = self::generateDefaultData();
|
||||
$this->name = $this->nextLabel = $this->label = $name;
|
||||
$this->name = $name;
|
||||
$this->setLabel($name);
|
||||
$this->setDescription($description);
|
||||
$this->usageMessage = $usageMessage === null ? "/" . $name : $usageMessage;
|
||||
$this->setAliases($aliases);
|
||||
$this->timings = new TimingsHandler("** Command: " . $name);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -208,6 +208,9 @@ abstract class Command{
|
||||
public function setLabel($name){
|
||||
$this->nextLabel = $name;
|
||||
if(!$this->isRegistered()){
|
||||
if($this->timings instanceof TimingsHandler){
|
||||
$this->timings->remove();
|
||||
}
|
||||
$this->timings = new TimingsHandler("** Command: " . $name);
|
||||
$this->label = $name;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user