[New-bugs-announce] [issue26588] _tracemalloc: add support for multiple address spaces (domains)

STINNER Victor report at bugs.python.org
Fri Mar 18 17:39:27 EDT 2016


New submission from STINNER Victor:

The tracemalloc module uses a hashtable: pointer (void*) => trace. Some embedded devices use multiple address spaces. Each GPU also has its own address space. CUDA, OpenCL and OpenGL should also be seen as different address spaces.

In the issue #26530, it was proposed (required?) to support multiple addresses spaces to be able to use tracemalloc in numpy.

Attached patch enhances tracemalloc to use (pointer: void*, domain: unsigned int) as key in the hashtable. A (pointer, domain) key is stored in a hashtable entry.

In the patch, the domain is hardcoded to 0, but the issue #26530 will add new C functions to track/untrack memory blocks, and this new functions will have a domain parameter.

The patch changes how a key is passed to the hashtable API: pass a *pointer* to a key rather than directly the key value. Because of that, the patch is quite long.

The patch also removes the unused function _Py_hashtable_hash_int().

_Py_HASHTABLE_ENTRY_DATA() macro now requires the hashtable to get the key size, since the offset of data now depends on the key size.

----------
components: Extension Modules
files: tracemalloc.patch
keywords: patch
messages: 261997
nosy: haypo, njs, pitrou
priority: normal
severity: normal
status: open
title: _tracemalloc: add support for multiple address spaces (domains)
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file42207/tracemalloc.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26588>
_______________________________________


More information about the New-bugs-announce mailing list