Message261997
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. |
|
Date |
User |
Action |
Args |
2016-03-18 21:39:28 | vstinner | set | recipients:
+ vstinner, pitrou, njs |
2016-03-18 21:39:27 | vstinner | set | messageid: <1458337167.06.0.908004959718.issue26588@psf.upfronthosting.co.za> |
2016-03-18 21:39:26 | vstinner | link | issue26588 messages |
2016-03-18 21:39:26 | vstinner | create | |
|