memory leak may occur · Issue #9 · nphilipp/python-slip · GitHub
Skip to content

memory leak may occur #9

Description

@alittlesir

Is there something wrong with this code? Object.connections_smobjs[self.connection] = \

One firewall corresponds to one connection. Therefore, there is only one connection. So it go in if self.connection not in Object.connections_senders the first time, and never get in again. This code (Object.connections_smobjs[self.connection] = \ )should not be indented.

If indented, then connections_senders will only increase and never remove. The memory will leak this way. Am i right?

Because we encountered a memory leak on firewalld, the final location is this indentation caused. I look forward to your reply, although you don't maintain slip anymore

    def sender_seen(self, sender):
        if (sender, self.connection) not in Object.senders:
            Object.senders.add((sender, self.connection))
            if self.connection not in Object.connections_senders:
                Object.connections_senders[self.connection] = set()
                Object.connections_smobjs[self.connection] = \
                    self.connection.add_signal_receiver(
                        handler_function=self._name_owner_changed,
                        signal_name='NameOwnerChanged',
                        dbus_interface='org.freedesktop.DBus',
                        arg1=sender)
            Object.connections_senders[self.connection].add(sender)

maybe it is correct

    def sender_seen(self, sender):
        if (sender, self.connection) not in Object.senders:
            Object.senders.add((sender, self.connection))
            if self.connection not in Object.connections_senders:
                Object.connections_senders[self.connection] = set()
            Object.connections_smobjs[self.connection] = \
                self.connection.add_signal_receiver(
                    handler_function=self._name_owner_changed,
                    signal_name='NameOwnerChanged',
                    dbus_interface='org.freedesktop.DBus',
                    arg1=sender)
            Object.connections_senders[self.connection].add(sender)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions