Ignoring the actual utility, I have the following classes:
from multiprocessing import Manager
import threading
class MgrStaticTarget(object):
def __init__(self):
self._mgr = Manager()
self._thd = threading.Thread(target=self.async_targ)
@staticmethod
def async_targ():
pass
class MgrInstanceTarget(object):
def __init__(self):
self._mgr = Manager()
self._thd = threading.Thread(target=self.async_targ)
def async_targ(self):
pass
and I'm observing behavior I don't understand. Upon repeated instantiations of MgrInstanceTarget using a Python shell in the following manner:
i = MgrInstanceTarget()
i = MgrInstanceTarget()
i = MgrInstanceTarget()
i = MgrInstanceTarget()
the multiprocessing.Manager server processes (or at least that's what I believe they are from) are accumulating.
However, if I instantiate MgrStaticTarget in the same manner the server processes do not accumulate. The only processes that exist are the one for the most recent Manager server process and the python shell. What's going on here?