tulir / gomuks

A terminal based Matrix client written in Go.
https://maunium.net/go/gomuks
GNU Affero General Public License v3.0
1.3k stars 124 forks source link

Memory leak in gomuks #281

Open pvonmoradi opened 3 years ago

pvonmoradi commented 3 years ago

Upon startup, the application uses ~500MiB and quickly climbs up to 900 MiB. After ~10 minutes, it reaches 3 GiB of RAM usage.
Also the input field for message is laggy (~5 seconds delay). gomuks version v0.2.3
Here is the resource usage from htop:

https://user-images.githubusercontent.com/1058151/114294144-ba467280-9ab1-11eb-8e09-9e037c91b6d1.mp4

There is also some exceptions thrown upon /quit:


panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x92d2ef]

goroutine 177 [running]:
maunium.net/go/gomuks/debug.Recover()
    /builds/tulir/gomuks/debug/debug.go:109 +0x98
panic(0xe660a0, 0x16853b0)
    /usr/local/go/src/runtime/panic.go:969 +0x1b9
maunium.net/go/gomuks/matrix.(*HistoryManager).store(0x0, 0xc0000c10e0, 0xc036be3c58, 0x1, 0x1, 0xc05375a201, 0x0, 0x0, 0x0, 0x0, ...)
    /builds/tulir/gomuks/matrix/history.go:153 +0x6f
maunium.net/go/gomuks/matrix.(*HistoryManager).Append(...)
    /builds/tulir/gomuks/matrix/history.go:144
maunium.net/go/gomuks/matrix.(*Container).HandleMessage(0xc00027ae70, 0x22, 0xc00d0db880)
    /builds/tulir/gomuks/matrix/matrix.go:623 +0x135
maunium.net/go/gomuks/matrix.(*GomuksSyncer).notifyListeners(0xc000122b90, 0x22, 0xc00d0db880)
    /builds/tulir/gomuks/matrix/sync.go:217 +0x94
maunium.net/go/gomuks/matrix.(*GomuksSyncer).processSyncEvent(0xc000122b90, 0xc0000c10e0, 0xc00d0db880, 0x22)
    /builds/tulir/gomuks/matrix/sync.go:194 +0xf7
maunium.net/go/gomuks/matrix.(*GomuksSyncer).processSyncEvents(0xc000122b90, 0xc0000c10e0, 0xc036bffa00, 0x32, 0x3f, 0x22)
    /builds/tulir/gomuks/matrix/sync.go:161 +0x57
maunium.net/go/gomuks/matrix.(*GomuksSyncer).processJoinedRoom(0xc000122b90, 0xc02fb961a0, 0x1e, 0x0, 0x0, 0x0, 0xc03615b890, 0xc03615b8b0, 0xc0380528c0, 0x18, ...)
    /builds/tulir/gomuks/matrix/sync.go:125 +0x1d6
created by maunium.net/go/gomuks/matrix.(*GomuksSyncer).ProcessResponse
    /builds/tulir/gomuks/matrix/sync.go:86 +0x412
pushqrdx commented 3 years ago

it's also weird that a cli client is using 150+mb this is a lot