New submission from Kristján Valur Jónsson <krist...@ccpgames.com>:

Holding the "keymutex" lock during malloc and free operations is not a good 
idea.  The reason is, that custom implementations of malloc and free, can use 
the TLS themselves.  This is, for example, true in embedded situations, where 
one wants to replace malloc with, e.g. appMalloc, (to monitor the memory useage 
of Python) and appMalloc itself uses python TLS to find the current python 
State.

This change makes the malloc and free calls outside the lock.  The change in 
PyThread_set_key_value, requiring an extra lock allocate, has no significant 
performance impact since this is a rare api.

----------
components: Interpreter Core
files: tlspatch.patch
keywords: patch, patch
messages: 115743
nosy: krisvale
priority: normal
severity: normal
status: open
title: Release the TLS lock during allocations
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file18782/tlspatch.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9787>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to