You may not be fully understanding the difference between these sets of functions.
The first set of functions, the allocation functions, are used by Vulkan to allocate CPU memory... most of the time. The other two functions, the internal notification functions, are for the other times.
See, there are times when the Vulkan implementation needs to make OS-specific system calls to allocate memory. The Vulkan specification recognizes such a case: to allocate "executable memory": memory containing opcodes for the CPU's instruction set. For security reasons, OS's don't let you just execute random memory addresses; modern OS's require most apps to allocate memory in a special way in order for it to be executable. Therefore:
The application is not expected to handle allocating memory that is intended for execution by the host due to the complexities of differing security implementations across multiple platforms. The implementation will allocate such memory internally and invoke an application provided informational callback when these internal allocations are allocated and freed.
Normal memory allocation functions like ::operator new
or malloc
can't do that. And the Vulkan specification does not expect the client code to be able to make those system calls either.
However, the client code may need to be able to track such allocations, so that it can know how much memory the Vulkan implementation is keeping around. Therefore, when "internal allocations" are made/freed, the internal notification functions are called.
This is the only time such functions are called.
So if your goal is just to track when implementation allocations are being made/freed, the internal notification functions alone are not going to get the job done. You have to override them all, which means you'll need to actually do the allocation/reallocation/freeing.