Releasing version 3.0.1

Some fixes in tests for Nvidia cards.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d5498d..cd209f9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+# 3.0.1 (2022-05-26)
+
+- Fixes in defragmentation algorithm.
+- Fixes in GpuMemDumpVis.py regarding image height calculation.
+- Other bug fixes, optimizations, and improvements in the code and documentation.
+
 # 3.0.0 (2022-03-25)
 
 It has been a long time since the previous official release, so hopefully everyone has been using the latest code from "master" branch, which is always maintained in a good state, not the old version. For completeness, here is the list of changes since v2.3.0. The major version number has changed, so there are some compatibility-breaking changes, but the basic API stays the same and is mostly backward-compatible.
diff --git a/bin/VmaSample_Release_vs2019.exe b/bin/VmaSample_Release_vs2019.exe
index c9a36e0..f986fc8 100644
--- a/bin/VmaSample_Release_vs2019.exe
+++ b/bin/VmaSample_Release_vs2019.exe
Binary files differ
diff --git a/docs/html/index.html b/docs/html/index.html
index 4f8502e..67bdb90 100644
--- a/docs/html/index.html
+++ b/docs/html/index.html
@@ -65,7 +65,7 @@
   <div class="headertitle"><div class="title">Vulkan Memory Allocator </div></div>
 </div><!--header-->
 <div class="contents">
-<div class="textblock"><p ><b>Version 3.0.1-development (2022-03-28)</b></p>
+<div class="textblock"><p ><b>Version 3.0.1 (2022-05-26)</b></p>
 <p >Copyright (c) 2017-2022 Advanced Micro Devices, Inc. All rights reserved. <br  />
 License: MIT</p>
 <p ><b>API documentation divided into groups:</b> <a href="modules.html">Modules</a></p>
diff --git a/docs/html/struct_vma_vulkan_functions.html b/docs/html/struct_vma_vulkan_functions.html
index dd38a3b..2f08bd9 100644
--- a/docs/html/struct_vma_vulkan_functions.html
+++ b/docs/html/struct_vma_vulkan_functions.html
@@ -118,7 +118,7 @@
 <tr class="memdesc:a9d8d1b05d2b1e7e1d9b27f6f585acf9c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fetch "vkGetBufferMemoryRequirements2" on Vulkan &gt;= 1.1, fetch "vkGetBufferMemoryRequirements2KHR" when using VK_KHR_dedicated_allocation extension.  <a href="struct_vma_vulkan_functions.html#a9d8d1b05d2b1e7e1d9b27f6f585acf9c">More...</a><br /></td></tr>
 <tr class="separator:a9d8d1b05d2b1e7e1d9b27f6f585acf9c"><td class="memSeparator" colspan="2">&#160;</td></tr>
 <tr class="memitem:a9cdcdc1e2b2ea7c571f7d27e30ba6875"><td class="memItemLeft" align="right" valign="top">PFN_vkGetImageMemoryRequirements2KHR&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_vulkan_functions.html#a9cdcdc1e2b2ea7c571f7d27e30ba6875">vkGetImageMemoryRequirements2KHR</a></td></tr>
-<tr class="memdesc:a9cdcdc1e2b2ea7c571f7d27e30ba6875"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fetch "vkGetImageMemoryRequirements 2" on Vulkan &gt;= 1.1, fetch "vkGetImageMemoryRequirements2KHR" when using VK_KHR_dedicated_allocation extension.  <a href="struct_vma_vulkan_functions.html#a9cdcdc1e2b2ea7c571f7d27e30ba6875">More...</a><br /></td></tr>
+<tr class="memdesc:a9cdcdc1e2b2ea7c571f7d27e30ba6875"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fetch "vkGetImageMemoryRequirements2" on Vulkan &gt;= 1.1, fetch "vkGetImageMemoryRequirements2KHR" when using VK_KHR_dedicated_allocation extension.  <a href="struct_vma_vulkan_functions.html#a9cdcdc1e2b2ea7c571f7d27e30ba6875">More...</a><br /></td></tr>
 <tr class="separator:a9cdcdc1e2b2ea7c571f7d27e30ba6875"><td class="memSeparator" colspan="2">&#160;</td></tr>
 <tr class="memitem:a0c4907235aab9df2767b79836afa2dc9"><td class="memItemLeft" align="right" valign="top">PFN_vkBindBufferMemory2KHR&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="struct_vma_vulkan_functions.html#a0c4907235aab9df2767b79836afa2dc9">vkBindBufferMemory2KHR</a></td></tr>
 <tr class="memdesc:a0c4907235aab9df2767b79836afa2dc9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Fetch "vkBindBufferMemory2" on Vulkan &gt;= 1.1, fetch "vkBindBufferMemory2KHR" when using VK_KHR_bind_memory2 extension.  <a href="struct_vma_vulkan_functions.html#a0c4907235aab9df2767b79836afa2dc9">More...</a><br /></td></tr>
@@ -415,7 +415,7 @@
       </table>
 </div><div class="memdoc">
 
-<p>Fetch "vkGetImageMemoryRequirements 2" on Vulkan &gt;= 1.1, fetch "vkGetImageMemoryRequirements2KHR" when using VK_KHR_dedicated_allocation extension. </p>
+<p>Fetch "vkGetImageMemoryRequirements2" on Vulkan &gt;= 1.1, fetch "vkGetImageMemoryRequirements2KHR" when using VK_KHR_dedicated_allocation extension. </p>
 
 </div>
 </div>
diff --git a/include/vk_mem_alloc.h b/include/vk_mem_alloc.h
index 81b03b6..60f5720 100644
--- a/include/vk_mem_alloc.h
+++ b/include/vk_mem_alloc.h
@@ -25,7 +25,7 @@
 

 /** \mainpage Vulkan Memory Allocator

 

-<b>Version 3.0.1-development (2022-03-28)</b>

+<b>Version 3.0.1 (2022-05-26)</b>

 

 Copyright (c) 2017-2022 Advanced Micro Devices, Inc. All rights reserved. \n

 License: MIT

diff --git a/src/Tests.cpp b/src/Tests.cpp
index dfa08d6..bb41774 100644
--- a/src/Tests.cpp
+++ b/src/Tests.cpp
@@ -58,7 +58,6 @@
 };
 
 static constexpr CONFIG_TYPE ConfigType = CONFIG_TYPE_AVERAGE;
-//static constexpr CONFIG_TYPE ConfigType = CONFIG_TYPE_LARGE;
 
 enum class FREE_ORDER { FORWARD, BACKWARD, RANDOM, COUNT };
 
@@ -1755,13 +1754,13 @@
                                 localCreateInfo.usage = VMA_MEMORY_USAGE_CPU_ONLY;
                                 break;
                             }
-                            TEST(vmaAllocateMemory(g_hAllocator, &memReq, &localCreateInfo, &alloc, nullptr) == VK_SUCCESS);
+                            TEST(vmaAllocateMemory(g_hAllocator, &memReq, &localCreateInfo, &alloc, nullptr) == VK_SUCCESS || alloc == VK_NULL_HANDLE);
                             break;
                         }
                         case 1:
                         {
                             VkBuffer buffer;
-                            TEST(vmaCreateBuffer(g_hAllocator, &buffCreateInfo, &allocCreateInfo, &buffer, &alloc, nullptr) == VK_SUCCESS);
+                            TEST(vmaCreateBuffer(g_hAllocator, &buffCreateInfo, &allocCreateInfo, &buffer, &alloc, nullptr) == VK_SUCCESS || alloc == VK_NULL_HANDLE);
                             vkDestroyBuffer(g_hDevice, buffer, g_Allocs);
                             break;
                         }
@@ -1771,7 +1770,7 @@
                             imgCreateInfo.extent.width = 512;
                             imgCreateInfo.extent.height = 1;
                             VkImage image;
-                            TEST(vmaCreateImage(g_hAllocator, &imgCreateInfo, &allocCreateInfo, &image, &alloc, nullptr) == VK_SUCCESS);
+                            TEST(vmaCreateImage(g_hAllocator, &imgCreateInfo, &allocCreateInfo, &image, &alloc, nullptr) == VK_SUCCESS || alloc == VK_NULL_HANDLE);
                             vkDestroyImage(g_hDevice, image, g_Allocs);
                             break;
                         }
@@ -1781,26 +1780,29 @@
                             imgCreateInfo.extent.width = 1024;
                             imgCreateInfo.extent.height = 512;
                             VkImage image;
-                            TEST(vmaCreateImage(g_hAllocator, &imgCreateInfo, &allocCreateInfo, &image, &alloc, nullptr) == VK_SUCCESS);
+                            TEST(vmaCreateImage(g_hAllocator, &imgCreateInfo, &allocCreateInfo, &image, &alloc, nullptr) == VK_SUCCESS || alloc == VK_NULL_HANDLE);
                             vkDestroyImage(g_hDevice, image, g_Allocs);
                             break;
                         }
                         }
 
-                        switch (data)
+                        if(alloc)
                         {
-                        case 1:
-                            vmaSetAllocationUserData(g_hAllocator, alloc, (void*)16112007);
-                            break;
-                        case 2:
-                            vmaSetAllocationName(g_hAllocator, alloc, "SHEPURD");
-                            break;
-                        case 3:
-                            vmaSetAllocationUserData(g_hAllocator, alloc, (void*)26012010);
-                            vmaSetAllocationName(g_hAllocator, alloc, "JOKER");
-                            break;
+                            switch (data)
+                            {
+                            case 1:
+                                vmaSetAllocationUserData(g_hAllocator, alloc, (void*)16112007);
+                                break;
+                            case 2:
+                                vmaSetAllocationName(g_hAllocator, alloc, "SHEPURD");
+                                break;
+                            case 3:
+                                vmaSetAllocationUserData(g_hAllocator, alloc, (void*)26012010);
+                                vmaSetAllocationName(g_hAllocator, alloc, "JOKER");
+                                break;
+                            }
+                            allocs.emplace_back(alloc);
                         }
-                        allocs.emplace_back(alloc);
                     }
                 }
 
@@ -4120,7 +4122,8 @@
             TEST(i == 0 || allocInfo.offset > prevOffset);
             bufInfo.push_back(newBufInfo);
             prevOffset = allocInfo.offset;
-            bufSumSize += bufCreateInfo.size;
+            TEST(allocInfo.size >= bufCreateInfo.size);
+            bufSumSize += allocInfo.size;
         }
 
         // Validate pool stats.
diff --git a/src/VmaUsage.h b/src/VmaUsage.h
index 47cc87d..b3b0eef 100644
--- a/src/VmaUsage.h
+++ b/src/VmaUsage.h
@@ -60,7 +60,7 @@
 //#define VMA_MAPPING_HYSTERESIS_ENABLED 0
 
 //#define VMA_VULKAN_VERSION 1003000 // Vulkan 1.3
-#define VMA_VULKAN_VERSION 1002000 // Vulkan 1.2
+//#define VMA_VULKAN_VERSION 1002000 // Vulkan 1.2
 //#define VMA_VULKAN_VERSION 1001000 // Vulkan 1.1
 //#define VMA_VULKAN_VERSION 1000000 // Vulkan 1.0
 
diff --git a/src/VulkanSample.cpp b/src/VulkanSample.cpp
index d7b0db9..a399035 100644
--- a/src/VulkanSample.cpp
+++ b/src/VulkanSample.cpp
@@ -35,8 +35,8 @@
 static const char* const SHADER_PATH2 = "../bin/";
 static const wchar_t* const WINDOW_CLASS_NAME = L"VULKAN_MEMORY_ALLOCATOR_SAMPLE";
 static const char* const VALIDATION_LAYER_NAME = "VK_LAYER_KHRONOS_validation";
-static const char* const APP_TITLE_A =     "Vulkan Memory Allocator Sample 3.0.0";
-static const wchar_t* const APP_TITLE_W = L"Vulkan Memory Allocator Sample 3.0.0";
+static const char* const APP_TITLE_A =     "Vulkan Memory Allocator Sample 3.0.1";
+static const wchar_t* const APP_TITLE_W = L"Vulkan Memory Allocator Sample 3.0.1";
 
 static const bool VSYNC = true;
 static const uint32_t COMMAND_BUFFER_COUNT = 2;
diff --git a/tools/GpuMemDumpVis/GpuMemDumpVis.py b/tools/GpuMemDumpVis/GpuMemDumpVis.py
index 42800ea..c4ab206 100644
--- a/tools/GpuMemDumpVis/GpuMemDumpVis.py
+++ b/tools/GpuMemDumpVis/GpuMemDumpVis.py
@@ -25,7 +25,7 @@
 from PIL import Image, ImageDraw, ImageFont
 
 
-PROGRAM_VERSION = 'Vulkan/D3D12 Memory Allocator Dump Visualization 3.0.0'
+PROGRAM_VERSION = 'Vulkan/D3D12 Memory Allocator Dump Visualization 3.0.1'
 IMG_WIDTH = 1200
 IMG_MARGIN = 8
 TEXT_MARGIN = 4