aboutsummaryrefslogtreecommitdiff
path: root/matrix
diff options
context:
space:
mode:
Diffstat (limited to 'matrix')
-rw-r--r--matrix/matrix.go7
-rw-r--r--matrix/rooms/room.go6
2 files changed, 10 insertions, 3 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index 1a75f96..cfd5614 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -29,7 +29,9 @@ import (
"path"
"path/filepath"
"regexp"
+ "runtime"
"time"
+ dbg "runtime/debug"
"maunium.net/go/mautrix"
"maunium.net/go/mautrix/format"
@@ -232,6 +234,11 @@ func (c *Container) OnLogin() {
debug.Print("Adding rooms to UI")
c.ui.MainView().SetRooms(c.config.Rooms)
c.ui.Render()
+ // The initial sync can be a bit heavy, so we force run the GC here
+ // after cleaning up rooms from memory above.
+ debug.Print("Running GC")
+ runtime.GC()
+ dbg.FreeOSMemory()
}
c.client.Syncer = c.syncer
diff --git a/matrix/rooms/room.go b/matrix/rooms/room.go
index a0918b1..be91065 100644
--- a/matrix/rooms/room.go
+++ b/matrix/rooms/room.go
@@ -148,6 +148,9 @@ func (room *Room) Load() {
room.lock.Lock()
room.load()
room.lock.Unlock()
+ if room.postLoad != nil {
+ room.postLoad()
+ }
}
func (room *Room) load() {
@@ -177,9 +180,6 @@ func (room *Room) load() {
debug.Print("Failed to decode room state:", err)
}
room.changed = false
- if room.postLoad != nil {
- room.postLoad()
- }
}
func (room *Room) Touch() {