This is a working version without significant leak.
def update(image_view, ui_image):
image_view.image = ui_image
all_photos = photos.get_assets()
for p in all_photos:
ui_image = p.get_ui_image(size=(300,300))
#image_data = p.get_image_data()
v = ui.View()
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor:
Thanks very much for all the suggestions. I'm grateful for the tip about threading and will try to incorporate it into the rest of the project but the thing that does the lifting here is the autoreleasepool context manager; with just this addition and removing the threading it works just fine.