The above facilities are implemented with the VIPS core function im_add_close_callback(). You can use this facility to make your own local resource allocators for other types of object -- see the manual page for more help.
im_add_close_callback()