Fix memory leak by holding on to Emoji references weakly.
The library had a memory leak in the case using the global emoji cache. When the bot would leave the guild, the Emoji would maintain a strong reference to the Guild keeping them alive along with the entire state associated with it.
This commit is contained in:
parent
46951e27f7
commit
aef170d7e0
@ -70,8 +70,8 @@ class ConnectionState:
|
|||||||
def clear(self):
|
def clear(self):
|
||||||
self.user = None
|
self.user = None
|
||||||
self._users = weakref.WeakValueDictionary()
|
self._users = weakref.WeakValueDictionary()
|
||||||
|
self._emojis = weakref.WeakValueDictionary()
|
||||||
self._calls = {}
|
self._calls = {}
|
||||||
self._emojis = {}
|
|
||||||
self._guilds = {}
|
self._guilds = {}
|
||||||
self._voice_clients = {}
|
self._voice_clients = {}
|
||||||
self._private_channels = {}
|
self._private_channels = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user