I'm running Nakama Typescript server in my docker, and I do see memory leaking.
The graph dropping down is when I Restarted the machine..
However I Create matches and terminate them, still I see memory aggregating.
I do have logging active. People tell me to disable logging would save memory. However, I do feel like there is something wrong.
I use TS template code mainly from your demo repo. And I even optimise my matchLoop to use dispatch.roadcastMessageDeferred() in order to avid excessive socket messaging.
let matchLoop: nkruntime.MatchLoopFunction<State> = function (
ctx: nkruntime.Context,
logger: nkruntime.Logger,
nk: nkruntime.Nakama,
dispatcher: nkruntime.MatchDispatcher,
tick: number,
state: State,
messages: nkruntime.MatchMessage[]
) {
const unifiedTransforms: { [key: string]: any } = {}
for (const message of messages) {
switch (message.opCode) {
// Transform Update
case OpCode.TRANSFORM_UPDATE:
let transformMsg = {} as any
try {
transformMsg = JSON.parse(nk.binaryToString(message.data))
unifiedTransforms[message.sender.userId] = transformMsg
} catch (error) {
logger.error("Bad data received: %v", error)
continue
}
break
case OpCode.STOP_SESSION:
return null
break
default:
// No other opcodes are expected from the client, so automatically treat it as an error.
dispatcher.broadcastMessage(OpCode.STATE_UPDATE_REJECTED, null, [message.sender])
logger.error("Unexpected opcode received: %d", message.opCode)
}
}
state.transforms = combineObjects(state.transforms, unifiedTransforms)
// Broadcast the unified state to all clients
dispatcher.broadcastMessageDeferred(OpCode.UNIFIED_STATE_UPDATE, JSON.stringify(state))
return { state }
}
I'm running Nakama Typescript server in my docker, and I do see memory leaking.![Screenshot 2024-05-22 at 18 04 58](https://github.com/heroiclabs/nakama/assets/10153413/b0b136ae-2325-40a0-b331-7610d8cadbcf)
The graph dropping down is when I Restarted the machine.. However I Create matches and terminate them, still I see memory aggregating.
I do have logging active. People tell me to disable logging would save memory. However, I do feel like there is something wrong. I use TS template code mainly from your demo repo. And I even optimise my matchLoop to use dispatch.roadcastMessageDeferred() in order to avid excessive socket messaging.
There was a similar issue on the forums: https://forum.heroiclabs.com/t/memory-leak-profiling/615 - but it seemed amazon specific.
Your Environment