Do Any API Objects Need to be Manually Kept Alive?

Mostly, they do not.

  • Command buffer and descriptor set objects will keep references to any objects they contain (submitted/updated into them respectively) until reset is called.
  • Any nested objects will keep alive underlying objects. For example, image view objects will keep alive the image objects underneath, pipelines will keep their pipeline layouts alive, and so on.

There are some notable exceptions:

  • Command pool and descriptor pool objects. These objects are not kept alive by their command buffer and descriptor set objects. This means that they must be kept alive until no longer required, and command/descriptor pools must be destroyed only after any of their objects are released.
  • Command buffer objects must be kept alive as long as they are executing (rendering) which generally means waiting on their associated fences. This rule, in conjunction with the previous one, means that destruction must happen in the following order:
    1. Frame done.
    2. Commands released.
    3. Pools released.