Pythonista crashes after extensive use of scene.load_image_data (and .load_pil_image)
While developing a streaming app for Pythonista I noticed that it usually crashes after some time. Turns out it's somehow related to loading/unloading images with
scene. Here is a minimal example that crashes Pythonista reliably:
import scene import random from cStringIO import StringIO import Image def raw_jpeg(img): buf = StringIO() img.save(buf, 'JPEG', quality=50) data = buf.getvalue()[::] buf.close() return data imglist = [raw_jpeg(img) for img in [ Image.new('RGB', (512, 384), 'red'), Image.new('RGB', (512, 384), 'yellow'), Image.new('RGB', (512, 384), 'green'), Image.new('RGB', (512, 384), 'blue'), Image.new('RGB', (512, 384), 'gray'), ]] imgnames =  while True: name = scene.load_image_data(random.choice(imglist)) if len(imgnames) == 16: scene.unload_image(imgnames.pop(0)) imgnames.append(name) print name
It takes a variable amount of time, somewhere between a second and a minute I'd say. And using
scene.load_pil_imageinstead does not help, but only makes the loading process slower.
Am I missing something?
scene.unload_imageshould free memory, and since this example never exceeds 16 images loaded at once it should have plenty of that.
EDIT: I am using iPad 4 and what seems to be the latest version of Pythonista.
Are you in the beta? I seem to recall that I recently fixed a bug in
unload_image, but it's not in the App Store version yet.
Edit: I just saw that you're using the latest App Store version... Let me know if you'd be interested in checking out the beta.
@omz how long would it take for this fix to make it into the App Store? Also, will getting the beta affect my files/settings in any way?
This post is deleted!last edited by