STINNER Victor added the comment:

Patch without test.

I chose to require the GIL to be held for efficiency. IMHO the common case is 
more than the GIL is held.

Example to call the function if the GIL is not held:

    int res;
    PyGILState_STATE gil_state;
    gil_state = PyGILState_Ensure();
    res = _PyTraceMalloc_Track(ptr, size);
    PyGILState_Release(gil_state);
    return res;

See also my numpy pull request on PyMem_Malloc() called without the GIL being 
held:
https://github.com/numpy/numpy/pull/7404

----------
keywords: +patch
Added file: http://bugs.python.org/file42115/tracemalloc_track.patch

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

Reply via email to