Minor fixes in both the library and tests.
diff --git a/src/Tests.cpp b/src/Tests.cpp
index 1810d65..aececf3 100644
--- a/src/Tests.cpp
+++ b/src/Tests.cpp
@@ -667,6 +667,7 @@
 

 void SaveAllocatorStatsToFile(const wchar_t* filePath)

 {

+    wprintf(L"Saving JSON dump to file \"%s\"\n", filePath);

     char* stats;

     vmaBuildStatsString(g_hAllocator, &stats, VK_TRUE);

     SaveFile(filePath, stats, strlen(stats));

@@ -1719,8 +1720,13 @@
             }

         }

 

-        TEST(stats.allocationsMoved > 0 && stats.bytesMoved > 0);

-        TEST(stats.deviceMemoryBlocksFreed > 0 && stats.bytesFreed > 0);

+        // If corruption detection is enabled, GPU defragmentation may not work on

+        // memory types that have this detection active, e.g. on Intel.

+        if(VMA_DEBUG_DETECT_CORRUPTION == 0)

+        {

+            TEST(stats.allocationsMoved > 0 && stats.bytesMoved > 0);

+            TEST(stats.deviceMemoryBlocksFreed > 0 && stats.bytesFreed > 0);

+        }

     }

 

     ValidateGpuData(allocations.data(), allocations.size());

@@ -2877,6 +2883,8 @@
         VkDeviceSize totalSize = 0;

         while(totalSize < poolCreateInfo.blockSize / 3)

         {

+            // This test intentionally allows sizes that are aligned to 4 or 16 bytes.

+            // This is theoretically allowed and already uncovered one bug.

             memReq.size = bufSizeMin + rand.Generate() % (bufSizeMax - bufSizeMin);

             res = vmaAllocateMemory(g_hAllocator, &memReq, &allocCreateInfo, &alloc, nullptr);

             TEST(res == VK_SUCCESS);

@@ -5180,7 +5188,6 @@
     {

         ////////////////////////////////////////////////////////////////////////////////

         // Temporarily insert custom tests here:

-        

         return;

     }

 

diff --git a/src/vk_mem_alloc.h b/src/vk_mem_alloc.h
index 789cf0b..e6bdb49 100644
--- a/src/vk_mem_alloc.h
+++ b/src/vk_mem_alloc.h
@@ -11444,6 +11444,12 @@
     size_t allocIndex;

     VkResult res = VK_SUCCESS;

 

+    if(IsCorruptionDetectionEnabled())

+    {

+        size = VmaAlignUp<VkDeviceSize>(size, sizeof(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));

+        alignment = VmaAlignUp<VkDeviceSize>(alignment, sizeof(VMA_CORRUPTION_DETECTION_MAGIC_VALUE));

+    }

+

     {

         VmaMutexLockWrite lock(m_Mutex, m_hAllocator->m_UseMutex);

         for(allocIndex = 0; allocIndex < allocationCount; ++allocIndex)

@@ -12375,7 +12381,7 @@
     const bool canDefragmentOnCpu = maxCpuBytesToMove > 0 && maxCpuAllocationsToMove > 0 &&

         isHostVisible;

     const bool canDefragmentOnGpu = maxGpuBytesToMove > 0 && maxGpuAllocationsToMove > 0 &&

-        (VMA_DEBUG_DETECT_CORRUPTION == 0 || !(isHostVisible && isHostCoherent));

+        !IsCorruptionDetectionEnabled();

 

     // There are options to defragment this memory type.

     if(canDefragmentOnCpu || canDefragmentOnGpu)