mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-03 21:25:13 +00:00
[PR #833] Fix huge memory waste in IpcMain.Once [IMPORTANT] #1317
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/ElectronNET/Electron.NET/pull/833
State: closed
Merged: Yes
My app uses

IpcMain.Onceto wait for an "all good, next frame" message from the front end. It's updating data at rates well over 60fps, so I'm callingIpcMain.Oncea lot. I noticed that since I started doing this, my memory usage went waaay up (from 40-50Mb to about 800Mb), so I started investigating memory dumps, and indeed, I found this object:Which I later traced to be the object holding all of the socket listeners.
To fix this issue, all I had to do was replace the
Socket.OninIpcMain.OncewithSocket.Once<object>, and my memory usage went back down to 40-50Mb.