Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Probable memory leak #332

Open
mredig opened this issue Aug 9, 2022 · 0 comments
Open

Probable memory leak #332

mredig opened this issue Aug 9, 2022 · 0 comments

Comments

@mredig
Copy link

mredig commented Aug 9, 2022

This snippet starts at line 189 in AccountStore.swift

    var listenReferenceRoom: Any?

    public func paginate(room: NIORoom, event: MXEvent) {
        let timeline = room.room.timeline(onEvent: event.eventId)
        listenReferenceRoom = timeline?.listenToEvents { event, direction, roomState in
            if direction == .backwards {
                room.add(event: event, direction: direction, roomState: roomState)
            }
            self.objectWillChange.send()
        }
        timeline?.resetPaginationAroundInitialEvent(withLimit: 40) { _ in
            self.objectWillChange.send()
        }
    }

Every time this method is called, listenReferenceRoom is overwritten with a new value and the old one is not removed from listeners. Pretty sure that's a necessary thing, but not an expert in MatrixSDK to know for sure.

Something similar happens on line 151 in the same file, but I believe that method is only called once through the lifetime of the app.

@mredig mredig changed the title Probably memory leak Probable memory leak Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant