mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-06 11:57:10 +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\utils\ExceptionTraceCleaner;
|
||||
use raklib\utils\InternetAddress;
|
||||
use function gc_enable;
|
||||
use function gc_disable;
|
||||
use function ini_set;
|
||||
|
||||
class RakLibServer extends Thread{
|
||||
@ -82,10 +82,9 @@ class RakLibServer extends Thread{
|
||||
}
|
||||
|
||||
protected function onRun() : void{
|
||||
//TODO: switch to manually triggered GC
|
||||
//the best time to do it is between ticks when the server would otherwise be sleeping, but RakLib's current
|
||||
//design doesn't allow this as of 1.1.1
|
||||
gc_enable();
|
||||
//RakLib has cycles (e.g. ServerSession <-> Server) but these cycles are explicitly cleaned up anyway, and are
|
||||
//very few, so it's pointless to waste CPU time on GC
|
||||
gc_disable();
|
||||
|
||||
ini_set("display_errors", '1');
|
||||
ini_set("display_startup_errors", '1');
|
||||
|
Loading…
x
Reference in New Issue
Block a user