Issue with ExtInt callback and snapshot

Hi all,

I am basically trying to have a triggered snapshot.
For this, I use et ExtInt set up on a rising edge of an IO (feed by my Arduino), then inside my callback func, I take a snapshot.
In other words:

def callback(line):
global img
img = sensor.snapshot()

extint = pyb.ExtInt(Pin(‘P1’), pyb.ExtInt.IRQ_RISING, pyb.Pin.PULL_NONE, callback)

However I get a “MemoryError: memory allocation failed, heap is locked”, and as far as I understand, it seems that the snapshot call is allocating some memory, which is forbidden in the ExtInt callback function.

I wonder why the snapshot call do allocate any memory, and if there is a workaround to make this work.
Many thanks,
AL