This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients greg.ath, neologix, pitrou, vstinner
Date 2011-06-21.11:02:56
SpamBayes Score 1.0631496e-05
Marked as misclassified No
Message-id <1308654176.69.0.733792484541.issue12352@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2011-06-21 11:02:56vstinnersetrecipients: + vstinner, pitrou, neologix, greg.ath
2011-06-21 11:02:56vstinnersetmessageid: <1308654176.69.0.733792484541.issue12352@psf.upfronthosting.co.za>
2011-06-21 11:02:56vstinnerlinkissue12352 messages
2011-06-21 11:02:56vstinnercreate