I've run into a EXC_BAD_ACCESS with a piece of code that deals with data serialization. The code only fails on device (iPhone) and not on simulator. It also fails only on certain data types.
Here is a test code that reproduces the problem:
template <typename T>
void test_alignment() {
// allocate memory and record the original addr...
Does Visual Studio C++ 2008/2010 support _mm_malloc officially? It is defined in malloc.h but I can't find its description in the MSDN library.
...
Hi,
I have understood why memory should be aligned to 4 byte and 8 byte based on data width of the bus. But following statement confuses me
"IoDrive requires that all I/O performed on a device using O_DIRECT must be 512-byte
alligned and a multiple of 512 bytes in size."
What is the need for aligning address to 512 bytes.
...
I have some software that I have working on a redhat system with icc and it is working fine. When I ported the code to an IRIX system running with MIPS then I get some calculations that come out as "nan" when there should definitely be values there.
I dont have any good debuggers on the non-redhat system, but I have tracked down that so...
You can allocate a std::vector which allocates aligned heap memory by defining your own allocator.
You can allocate a c-style array on the stack using declspec align.
But can you declare a tr1::array which guarantees that the element at index zero will be aligned?
...
Hello
How will gcc set the alignment for variable/field with
__attribute__((aligned))
What about different gcc versions/ different platforms?
Testing code:
int main() {
printf("%d\n", (__alignof__(char __attribute__ ((aligned)) )) );
}
For x86, gcc 3.4, 4.1, 4.3 I got 16.
...
I thought I understood how C/C++ handled struct member alignment. But I'm getting strange results for a particular arrangement in Visual Studio 2008 and 2010.
Specifically, I'm finding that a struct consisting of a char, short, and char is compiled into a 6-byte struct, even with 4- or 8-byte packing enabled. I am at a loss as to why th...
Can you tell by looking at them which of these addresses is word aligned?
0x000AE430
0X00014432
0X000B0737
0X0E0D8844
...
Is there any advantage defining an array's size to be a multiple of 8, if using 64 bit UNIX OS? I am intended to use this array for loading data from shared memory. So dependencies may exist on the operating system and the page size.
...