How to make value returned by rocksdb_iter_value 8byte aligned?

I store some byte arrays to rocksdb and want to get them through iterator. The bytes array returned by rocksdb_iter_value is not 8 byte aligned(address of this array % 8 != 0).Therefore, I have to copy the array to somewhere else that are 8 byte aligned, so that I can use this byte array correctly. Can I solve this problem without copy? Like force the returned value 8 byte aligned.

In the rocksdb code it is simple; replace the new DB_Iter in the file db_iter.cc with a memory aligned new .

1 Like