Commit b601cf0f authored by Kenton Varda's avatar Kenton Varda

Fix Windows: _aligned_malloc()'s agruments are reversed from aligned_alloc().

parent 5c14dadb
......@@ -253,8 +253,9 @@ void BTreeImpl::growTree(uint minCapacity) {
#elif _WIN32
// Windows lacks aligned_alloc() but has its own _aligned_malloc() (which requires freeing using
// _aligned_free()).
// WATCH OUT: The argument order for _aligned_malloc() is opposite of aligned_alloc()!
NodeUnion* newTree = reinterpret_cast<NodeUnion*>(
_aligned_malloc(sizeof(BTreeImpl::NodeUnion), newCapacity * sizeof(BTreeImpl::NodeUnion)));
_aligned_malloc(newCapacity * sizeof(BTreeImpl::NodeUnion), sizeof(BTreeImpl::NodeUnion)));
KJ_ASSERT(newTree != nullptr, "memory allocation failed", newCapacity);
#else
// Let's use the C11 standard.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment