C Specification

To destroy a device, call:

// Provided by VK_VERSION_1_0
void vkDestroyDevice(
    VkDevice                                    device,
    const VkAllocationCallbacks*                pAllocator);

Parameters

  • device is the logical device to destroy.

  • pAllocator controls host memory allocation as described in the Memory Allocation chapter.

Description

To ensure that no work is active on the device, vkDeviceWaitIdle can be used to gate the destruction of the device. Prior to destroying a device, an application is responsible for destroying/freeing any Vulkan objects that were created using that device as the first parameter of the corresponding vkCreate* or vkAllocate* command.

Note

The lifetime of each of these objects is bound by the lifetime of the VkDevice object. Therefore, to avoid resource leaks, it is critical that an application explicitly free all of these resources prior to calling vkDestroyDevice.

If VkPhysicalDeviceVulkanSC10Properties::deviceDestroyFreesMemory is VK_TRUE, the reserved memory for child objects without explicit free or destroy commands is returned to the system when the device is destroyed, otherwise it may not be returned to the system until the process is terminated.

Valid Usage
  • VUID-vkDestroyDevice-device-05137
    All child objects created on device , except those with no explicit free or destroy command, must have been destroyed prior to destroying device

Valid Usage (Implicit)
  • VUID-vkDestroyDevice-device-parameter
    If device is not NULL, device must be a valid VkDevice handle

  • VUID-vkDestroyDevice-pAllocator-null
    pAllocator must be NULL

Host Synchronization
  • Host access to device must be externally synchronized

  • Host access to all VkQueue objects created from device must be externally synchronized

See Also

Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0