Guide

Memory and lifetimes

The model owns everything it hands you. You never free anything the ABI returns; ay2d_free releases it all.

What Valid until
ids, names, folder names, motion and expression names the model is freed
texture bytes (ay2d_texture) the model is freed
uvs, indices, masks of a drawable the model is freed
positions of a drawable the update after next starts
ay2d_last_error() the next failing call on the same thread
bytes you pass to ay2d_load and the ay2d_add_* calls only read during the call

The positions rule comes from the two published results: a view from frame N stays good while frame N + 1 is made, and goes stale when frame N + 2 starts writing over it. Take a fresh list after each update and you never need to think about it.

A view from frame N stays good through update N+1 and goes stale when N+2 starts