Optix 7 module and program group lifetimes

Hello, in the programming guide it states:

Module lifetimes need to extend to the lifetimes of ProgramGroups that reference them. Modules may be destroyed after creating the OptixPipeline that uses them through the ProgramGroup objects.

Does the lifetime of the ProgramGroups need to be the same as the OptixPipeline that uses them, or can they safely be destroyed once the pipeline has been created?

Similarly, once a ProgramGroup has been packed into a SBT record header, can it be destroyed? Or must it live as long as the record?



Hi Anders,

I checked with the team and heard that you can safely destroy your program groups after they’ve been used to create your pipeline and SBT. Just to double-check, I modified the samples_exp/optixPathTracer sample, moving the optixProgramGroupDestroy() calls to the end of the createSBT() function, and it runs without problems.


Hi David, thanks for the info!