Software Archive
Read-only legacy content
17061 Discussions

Notes on Memory alignment of different C++ compilers

SergeyKostrov
Valued Contributor II
486 Views
*** Notes on Memory alignment of different C++ compilers *** C++ compilers always differ in some functionality, or another, and memory allocation CRT-functions, like malloc or calloc, Not exceptions. Memory blocks allocated by these CRT-functions at different parts of Virtual Memory and have different alignments (!). More details will be submitted soon.
0 Kudos
12 Replies
SergeyKostrov
Valued Contributor II
486 Views
[ Part 1 - Debug configuration ] [ Microsoft C++ compiler - Debug ] ... Pointer 0x092D7E48 is aligned on 2-byte boundary Pointer 0x092D7E48 is aligned on 4-byte boundary Pointer 0x092D7E48 is aligned on 8-byte boundary Pointer 0x092D7E48 is Not aligned on 16-byte boundary Pointer 0x092D7E48 is Not aligned on 32-byte boundary Pointer 0x092D7E48 is Not aligned on 64-byte boundary ...
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
[ Borland C++ compiler - Debug ] ... Pointer 0x110D7020 is aligned on 2-byte boundary Pointer 0x110D7020 is aligned on 4-byte boundary Pointer 0x110D7020 is aligned on 8-byte boundary Pointer 0x110D7020 is aligned on 16-byte boundary Pointer 0x110D7020 is aligned on 32-byte boundary Pointer 0x110D7020 is Not aligned on 64-byte boundary ...
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
[ Intel C++ compiler - Debug ] ... Pointer 0x08DB9888 is aligned on 2-byte boundary Pointer 0x08DB9888 is aligned on 4-byte boundary Pointer 0x08DB9888 is aligned on 8-byte boundary Pointer 0x08DB9888 is Not aligned on 16-byte boundary Pointer 0x08DB9888 is Not aligned on 32-byte boundary Pointer 0x08DB9888 is Not aligned on 64-byte boundary ...
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
[ MinGW C++ compiler - Debug ] ... Pointer 0x1111BD30 is aligned on 2-byte boundary Pointer 0x1111BD30 is aligned on 4-byte boundary Pointer 0x1111BD30 is aligned on 8-byte boundary Pointer 0x1111BD30 is aligned on 16-byte boundary Pointer 0x1111BD30 is Not aligned on 32-byte boundary Pointer 0x1111BD30 is Not aligned on 64-byte boundary ...
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
[ Watcom C++ compiler - Debug ] ... Pointer 0x1101C748 is aligned on 2-byte boundary Pointer 0x1101C748 is aligned on 4-byte boundary Pointer 0x1101C748 is aligned on 8-byte boundary Pointer 0x1101C748 is Not aligned on 16-byte boundary Pointer 0x1101C748 is Not aligned on 32-byte boundary Pointer 0x1101C748 is Not aligned on 64-byte boundary ...
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
[ Part 2 - Release configuration ] [ Microsoft C++ compiler - Release ] ... Pointer 0x00377FC0 is aligned on 2-byte boundary Pointer 0x00377FC0 is aligned on 4-byte boundary Pointer 0x00377FC0 is aligned on 8-byte boundary Pointer 0x00377FC0 is aligned on 16-byte boundary Pointer 0x00377FC0 is aligned on 32-byte boundary Pointer 0x00377FC0 is aligned on 64-byte boundary ...
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
[ Borland C++ compiler - Release ] ... Pointer 0x10837040 is aligned on 2-byte boundary Pointer 0x10837040 is aligned on 4-byte boundary Pointer 0x10837040 is aligned on 8-byte boundary Pointer 0x10837040 is aligned on 16-byte boundary Pointer 0x10837040 is aligned on 32-byte boundary Pointer 0x10837040 is aligned on 64-byte boundary ...
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
[ Intel C++ compiler - Release ] ... Pointer 0x00359000 is aligned on 2-byte boundary Pointer 0x00359000 is aligned on 4-byte boundary Pointer 0x00359000 is aligned on 8-byte boundary Pointer 0x00359000 is aligned on 16-byte boundary Pointer 0x00359000 is aligned on 32-byte boundary Pointer 0x00359000 is aligned on 64-byte boundary ...
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
[ MinGW C++ compiler - Release ] ... Pointer 0x0023B1C0 is aligned on 2-byte boundary Pointer 0x0023B1C0 is aligned on 4-byte boundary Pointer 0x0023B1C0 is aligned on 8-byte boundary Pointer 0x0023B1C0 is aligned on 16-byte boundary Pointer 0x0023B1C0 is aligned on 32-byte boundary Pointer 0x0023B1C0 is aligned on 64-byte boundary ...
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
[ Watcom C++ compiler - Release ] ... Pointer 0x00336380 is aligned on 2-byte boundary Pointer 0x00336380 is aligned on 4-byte boundary Pointer 0x00336380 is aligned on 8-byte boundary Pointer 0x00336380 is aligned on 16-byte boundary Pointer 0x00336380 is aligned on 32-byte boundary Pointer 0x00336380 is aligned on 64-byte boundary ...
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
A list of CRT-functions to allocate and release aligned memory blocks is as follows: _mm_malloc _mm_free _aligned_malloc _aligned_offset_malloc _aligned_offset_realloc _aligned_offset_recalloc _aligned_realloc _aligned_recalloc _aligned_free Take into account that some of them are Not portable. As of today the best pair of functions to allocate and release aligned memory blocks is: _mm_malloc _mm_free and they could be considered as the most portable.
0 Kudos
SergeyKostrov
Valued Contributor II
486 Views
[ Computer System used for performance evaluations ] ** Dell Precision Mobile M4700 ** Intel Core i7-3840QM ( 2.80 GHz ) Ivy Bridge / 4 cores / 8 logical CPUs / ark.intel.com/products/70846 32GB RAM 320GB HDD NVIDIA Quadro K1000M ( 192 CUDA cores / 2GB memory ) Windows 7 Professional 64-bit SP1 Size of L3 Cache = 8MB ( shared between all cores for data & instructions ) Size of L2 Cache = 1MB ( 256KB per core / shared for data & instructions ) Size of L1 Cache = 256KB ( 32KB per core for data & 32KB per core for instructions ) Display resolution: 1366 x 768
0 Kudos
Reply