I have a problem about memory with flutter app, when using compute, I put this line in the function parameter in compute:
var image = imglib.Image.fromBytes(
For a starter like us, we need to understand that compute function is nothing but the isolate itself. and the more you call to create isolate the more memory you will be needing. This reference Isolates spawn will take ~ 2mb of ram and so we need to make isolates as less as possible even though you might say that I'm just computing and returning result so isolate might get GC call but no at a time you might be scrolling and caching or doing something with isolate or your code within that isolate can impact huge in-memory footprint.
so rather doing that I suggest you create one isolate and do whatever stuff you want to do and when you finish all you copy faces then close the isolate.
watch this video also to know how to use isolate