mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 04:17:07 +00:00
RakLibServer: disable GC
GC is not required for RakLib as it doesn't generate any unmanaged cycles. Cycles in general do exist (e.g. Server <-> ServerSession), but these are explicitly cleaned up, so GC wouldn't have any useful work to do.
This commit is contained in:
parent
aee358d329
commit
fea17fa4a9
@ -38,7 +38,7 @@ use raklib\server\ServerSocket;
|
|||||||
use raklib\server\SimpleProtocolAcceptor;
|
use raklib\server\SimpleProtocolAcceptor;
|
||||||
use raklib\utils\ExceptionTraceCleaner;
|
use raklib\utils\ExceptionTraceCleaner;
|
||||||
use raklib\utils\InternetAddress;
|
use raklib\utils\InternetAddress;
|
||||||
use function gc_enable;
|
use function gc_disable;
|
||||||
use function ini_set;
|
use function ini_set;
|
||||||
|
|
||||||
class RakLibServer extends Thread{
|
class RakLibServer extends Thread{
|
||||||
@ -82,10 +82,9 @@ class RakLibServer extends Thread{
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected function onRun() : void{
|
protected function onRun() : void{
|
||||||
//TODO: switch to manually triggered GC
|
//RakLib has cycles (e.g. ServerSession <-> Server) but these cycles are explicitly cleaned up anyway, and are
|
||||||
//the best time to do it is between ticks when the server would otherwise be sleeping, but RakLib's current
|
//very few, so it's pointless to waste CPU time on GC
|
||||||
//design doesn't allow this as of 1.1.1
|
gc_disable();
|
||||||
gc_enable();
|
|
||||||
|
|
||||||
ini_set("display_errors", '1');
|
ini_set("display_errors", '1');
|
||||||
ini_set("display_startup_errors", '1');
|
ini_set("display_startup_errors", '1');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user