STINNER Victor added the comment:

Patch version 5:

* add hashtable_compare_pointer_t() which compares pointer_t fields (ptr and 
domain) rather using _Py_hashtable_compare_direct() which causes issues with 
padding
* hashtable_hash_pointer_t() now uses memcpy() to get the pointer_t value 
rather than a pointer dereference

Antoine:
> What about compilers that don't support "__attribute__((packed))"?

packed is a small and *optional* optimization on the memory footprint of 
_tracemalloc structure (reduce tracemalloc.get_tracemalloc_memory()).

Using packed can introduce memory alignment issue, but since tracemalloc uses 
memcpy(), it *should* be fine in practice. Again, since I don't have access to 
SPARC CPU, I don't know how to test.

> Instead you could use a compare func that compares struct fields...

Done.

----------
Added file: http://bugs.python.org/file42234/tracemalloc-5.patch

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

Reply via email to