This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2017年10月31日 18:01 by skrah, last changed 2022年04月11日 14:58 by admin.
| Messages (4) | |||
|---|---|---|---|
| msg305320 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2017年10月31日 18:01 | |
This is related to #27987 and #20064 and perhaps the pymalloc patch from #18835. I think PyMem_Malloc() should guarantee alignof(max_align_t). It actually did before the "#define PYMEM_FUNCS PYOBJ_FUNCS" optimization, so we have a sort of regression here. |
|||
| msg305322 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2017年10月31日 18:07 | |
> I think PyMem_Malloc() should guarantee alignof(max_align_t). Do you mean the C++ std::max_align_t? Does C99 have something like that? The Linux malloc() manual page says: "The malloc() and calloc() functions return a pointer to the allocated memory, which is suitably aligned for any built-in type." But I don't know the list of C built-in types. |
|||
| msg305324 - (view) | Author: Stefan Krah (skrah) * (Python committer) | Date: 2017年10月31日 18:14 | |
> Do you mean the C++ std::max_align_t? Does C99 have something like that? > > The Linux malloc() manual page says: > > "The malloc() and calloc() functions return a pointer to the allocated memory, which is suitably aligned for any built-in type." C11 has max_align_t, but also for C99 "any builtin type" means 16 byte alignment for long double on x64, so malloc() and calloc() are required to align 16 bytes with -std=c99 (and earlier). max_align_t is just a shorthand to express the concept. |
|||
| msg311322 - (view) | Author: Florian Weimer (fweimer) | Date: 2018年01月31日 10:55 | |
max_align_t is a bit of a kitchen sink and will specify larger and larger alignment in the future, e.g. 32-byte alignment for a complex _Float128 type (a pair of two _Float128 variables). The alignment is also not generally useful for allocations whose size is smaller than the alignment. (Many mallocs do not follow the C standard and do not provide 16-byte alignment when 8 bytes are allocated, although alignof(max_align_t) is 16.) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:53 | admin | set | github: 76093 |
| 2018年01月31日 10:55:10 | fweimer | set | nosy:
+ fweimer messages: + msg311322 |
| 2018年01月31日 00:13:00 | gregory.p.smith | set | nosy:
+ twouters, gregory.p.smith |
| 2017年10月31日 18:14:43 | skrah | set | messages: + msg305324 |
| 2017年10月31日 18:07:15 | vstinner | set | messages: + msg305322 |
| 2017年10月31日 18:02:09 | skrah | set | nosy:
+ vstinner |
| 2017年10月31日 18:01:35 | skrah | create | |