APNs objects are not garbage collected in ehnaced mode. You can reproduce this by creating and disconnecting a new APNs object in a loop multiple times, sending notifications and disconnecting and see memory growing. Easy to check using a package like pympler.
APNs has a reference to GatewayConnection(APNsConnection).
GatewayConnection(APNsConnection) and ErrorResponseHandlerWorker(threading.Thread) have a circular reference to each other. In addition, python does not garbage collect circular references where a class has __del__ defines (APNsConnection in this case) which causes those object to remain in memory.
Removing __del__ from APNsConnection seems to fix memory issue but I am not sure if it introduces other side effects like not cleaning connections properly.
APNs objects are not garbage collected in ehnaced mode. You can reproduce this by creating and disconnecting a new APNs object in a loop multiple times, sending notifications and disconnecting and see memory growing. Easy to check using a package like pympler.
APNs has a reference to GatewayConnection(APNsConnection). GatewayConnection(APNsConnection) and ErrorResponseHandlerWorker(threading.Thread) have a circular reference to each other. In addition, python does not garbage collect circular references where a class has
__del__
defines (APNsConnection in this case) which causes those object to remain in memory.Removing
__del__
from APNsConnection seems to fix memory issue but I am not sure if it introduces other side effects like not cleaning connections properly.Hope I was clear.