PF_PreRenderOutput::pre_render_data — who frees it, and when? (SDK example doesn't show it)
Dear Adobe Teams,
Working through the After Effects SDK's (2019) Smart Render pattern, and the sample code leaves the ownership/lifetime of pre_render_data genuinely ambiguous.
In PF_Cmd_SMART_PRE_RENDER (SDK/Examples/Effect/R_O_I/R_O_I.cpp, ~line 201):
cpp
extra->output->pre_render_data = new ROI_RenderInfo();
ROI_RenderInfo infoP = reinterpret_cast<ROI_RenderInfo>(extra->output->pre_render_data);
if (!infoP) {
err = PF_Err_OUT_OF_MEMORY;
} else {
// ...infoP fields get filled in here...
}
Then in PF_Cmd_SMART_RENDER (~line 392), the same data comes back through extra->input:
cpp
info.we_care_about_alphaB = (static_cast<A_Boolean>(extra->input->pre_render_data));
That's the entire lifecycle shown in the sample. I checked the whole file for delete, free, or any assignment to output->delete_pre_render_data_func — there is none. The struct allocated with new in PreRender is read once in SmartRender and then never explicitly disposed anywhere in this 400+ line file.
Questions:
Since this sample never sets delete_pre_render_data_func, is AE expected to free pre_render_data on its own using some default mechanism (e.g. treating it as a simple heap block), or does this sample simply leak it?
If a plugin does set delete_pre_render_data_func, is AE responsible for calling it after SmartRender finishes with that data — and is that guaranteed to happen exactly once, even across multiple SmartRender calls against one PreRender result (e.g. multi-frame/multi-view renders)?
If the plugin is instead expected to free pre_render_data itself inside SmartRender, should R_O_I.cpp be treated as a known gap in the sample rather than the recommended pattern?
A short confirmation of which side owns the free — and whether this sample simply omits it — would clear this up. Thanks.
