VKFREEMEMORY(3)

NAME
vkFreeMemory - Free GPU memory

C SPECIFICATION

To free a memory object, call:

    void vkFreeMemory(
        VkDevice                                    device,
        VkDeviceMemory                              memory,
        const VkAllocationCallbacks*                pAllocator);

PARAMETERS

    • device is the logical device that owns the memory.

    • memory is the VkDeviceMemory object to be freed.

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

DESCRIPTION

Before freeing a memory object, an application must ensure the memory object is no longer in use by the device—for example by command buffers queued for execution. The memory can remain bound to images or buffers at the time the memory object is freed, but any further use of them (on host or device) for anything other than destroying those objects will result in undefined behavior. If there are still any bound images or buffers, the memory may not be immediately released by the implementation, but must be released by the time all bound images and buffers have been destroyed. Once memory is released, it is returned to the heap from which it was allocated.

How memory objects are bound to Images and Buffers is described in detail in the Resource Memory Association section.

If a memory object is mapped at the time it is freed, it is implicitly unmapped. Valid Usage

    • All submitted commands that refer to memory (via images or buffers) must have completed execution
Valid Usage (Implicit)

    • device must be a valid VkDevice handle

    • If memory is not VK_NULL_HANDLE, memory must be a valid VkDeviceMemory handle

    • If pAllocator is not NULL, pAllocator must be a pointer to a valid VkAllocationCallbacks structure

    • If memory is a valid handle, it must have been created, allocated, or retrieved from device
Host Synchronization

    • Host access to memory must be externally synchronized

SEE ALSO

VkAllocationCallbacks, VkDevice, VkDeviceMemory

DOCUMENT NOTES

For more information, see the Vulkan Specification at URL

https://www.khronos.org/registry/vulkan/specs/1.0/xhtml/vkspec.html#vkFreeMemory

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

COPYRIGHT

Copyright (c) 2014-2016 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.

AUTHOR

Khronos Group
    Author.