Will size of temporary update buffer change in different updates?

For example:

while(true)
{
    BuildInputsUpdate();
    // Do I need to query memory size to check resizing before AS update?
    // Or can I just allocate once out of the loop and use the same temporary buffer without worrying about resizing?
    ASUpdate(buffer);
}

The OptixAccelBufferSizes structure contains three values for the optixAccelBuild parameters.
The tempUpdateSizeInBytes shouldn’t change across AS updates.

If you search the OptiX SDK examples for that field name, you’ll find that the optixDynamicGeometry example checks if the state.temp_buffer_size is big enough for an AS update operation only once at the end of the buildMeshAccel function and not inside updateMeshAccel.

Please read this thread about potential performance pitfalls when continuously updating geometry AS:
https://forums.developer.nvidia.com/t/updating-as-leads-to-extremely-low-traversal-performance/267416

You might want to rebuild your AS in regular intervals to regain performance if your geometry updates result in such overlapping AABBs. When the motion of the geometric primitives is more continuous than the example image at the bottom of that thread, like when doing morphing, you might need fewer or no rebuilds.