STINNER Victor <victor.stin...@haypocalc.com> added the comment: > I also wonder about the performance cost of a recursive lock.
An alternative is to disable the garbage collector in malloc(): def malloc(self, size): ... enabled = gc.isenabled() if enabled: # disable the garbage collector to avoid a deadlock if block # is freed (if self.free() is called) gc.disable() try: with self._lock: size = self._roundup(max(size,1), self._alignment) ... return block finally: if enabled: gc.enable() gc.disable() and gc.enable() just set an internal flag and so should be fast. ---------- nosy: +haypo _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12352> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com