- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
*** 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.
Link Copied
12 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[ 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

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page