https://bugs.openldap.org/show_bug.cgi?id=10260
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED
--- Comment #3 from Howard Chu hyc@openldap.org --- (In reply to Sascha Brawer from comment #2)
Would you be open to documenting this in the public documentation, not only in internals? See below for a proposed patch.
Apologies for the nuisance, but from reading the public LMDB documentation, it's really not obvious that LMDB keys and values have different memory alignment than malloc(), which aligns to the platform’s largest primitive type (typically 8 bytes these days). Looking at some applications that use LMDB in the wild, they're happily reading mv_data pointers as int32_t*, uint64_t*, or as pointers to custom structs with i32/i64/float members. If LMDB’s mv_data is aligned to a 2-byte boundary, these applications will either crash or be very slow on non-Intel CPUs.
Just to clarify, I'm not asking LMDB to change its implementation. But I think it would be good to document the unusual alignment in the public lmdb.h header, not just in internals.
General DB users don't need to worry about such things, it is an internal implementation detail. People who need to worry about such things must read up on the DB internals.