git » sdk » commit 2eb86df

Do a full GC run before starting a client

author Stephen Paul Weber
2025-06-24 17:58:34 UTC
committer Stephen Paul Weber
2025-06-24 17:58:34 UTC
parent d0019c2ae332c80d577207b018778f6c70e4d855

Do a full GC run before starting a client

For example in iOS NSE we have 24MB limit and so let's make sure
anything we did before starting up this one gets cleaned up so we don't
get close to the limit.

snikket/Client.hx +4 -0

diff --git a/snikket/Client.hx b/snikket/Client.hx
index 42999e1..2284a9f 100644
--- a/snikket/Client.hx
+++ b/snikket/Client.hx
@@ -579,6 +579,10 @@ class Client extends EventEmitter {
 		Gets the client ready to use but does not connect to the server
 	**/
 	public function startOffline(ready: ()->Void) {
+		#if cpp
+		// Do a big GC before starting a new client
+		cpp.NativeGc.run(true);
+		#end
 		persistence.getLogin(accountId(), (clientId, loadedToken, loadedFastCount, displayName) -> {
 			token = loadedToken;
 			fastCount = loadedFastCount;