主要的思想是“内存对齐”。
你可以搜索一些关于“内存对齐”谷歌。
You can search something about "Memory Alignment" by Google.
我很高兴回答你的问题。主要的思想是“内存对齐”。你可以搜索一些关于“内存对齐”谷歌。
I'm glad to answer your question. The main idea is about the "Memory Alignment". You can search something about "Memory Alignment" by Google.
和更多的变量,内存不是连续的当你分配一些内存(内存对齐),所以它可能需要更多的内存比你认为。
And for more variables, the memory isn't really contiguous when you allocate some memory (memory-alignment), so it could take more memory than you think it takes.
正确的内存块对齐可以得到保证。
例如,根本就不存在寻址异常,因为所有的指针都是对齐的,并且在视图访问某处内存时都根据本地存储的大小进行了截断。
For example, there are no addressing exceptions since all Pointers get aligned and truncated to the local store size when attempting a memory access.
然而,这段新代码假定起始地址是按照16字节对齐的,并且末尾也有足够的填充位,因此内存中下一个数据元素也是16字节对齐的。
However, this new code now assumes that the starting address is 16-byte aligned, and also that it has enough padding on the end that the next data element in memory is also 16-byte aligned.
最重要的属性之一是aligned属性,它用于在内存中实现对象对齐。
One of the most important of these is the aligned attribute, which is used for object alignment in memory.
记住,lqd指令只能从16字节边界加载,所以它会在加载期间忽略最低有效的四位,而只会从内存加载已对齐的四字。
Remember, the LQD instruction only loads from 16-byte boundaries. It will therefore ignore the four least significant bits during the load, and just load an aligned quadword from memory.
个别数据结构的内存需求可能会发生改变,这依赖于编译器中实现对齐的方式。
The memory requirements of individual data structures might get altered, depending upon the way packing is implemented in the compiler.
为什么你不能访问一个4字节长的变量在未对齐地址(即不被4整除)一个内存访问,因为它与对齐地址的情况?
Why can't you access a 4 byte long variable in a single memory access on an unaligned address(i. e. not divisible by 4), as it's the case with aligned addresses?
在这个上下文,一个无效的指针是一个指向无效内存中的区域,是NULL,包含一个不对齐的指针,指向的内存块比必须的还小,等等。
In this context, an invalid pointer is one that points to an invalid region in memory, is NULL, contains an unaligned pointer, points to memory block smaller than necessary, and so on.
不知道什么是对的对齐的你在这方面的认识,但情况类似,每个指针分配动态内存指针的数组。
Not sure what is your understanding of aligned in this context but the situation is similar to a array of Pointers where each pointer is allocated dynamic memory.
在其他情况下,它可能会将内存地址与实际硬件边界对齐以优化性能。
In other cases it might align their memory addresses to natural hardware boundaries to optimize performance.
内存分配器必须给你一个16字节对齐块的空间,因为,在一般情况下,内存分配必须提供适当的对齐,内存可用于任何目的。
The memory allocator must give you a 16-byte aligned block of space, because, in general, memory allocation must provide suitable alignment so that the memory can be used for any purpose.
内存分配器必须给你一个16字节对齐块的空间,因为,在一般情况下,内存分配必须提供适当的对齐,内存可用于任何目的。
The memory allocator must give you a 16-byte aligned block of space, because, in general, memory allocation must provide suitable alignment so that the memory can be used for any purpose.
应用推荐