Ask Your Question

Revision history [back]

Sorry but I've not been able to respond to my own question until about now. It turns out that the code I posted above was form a function and so the variables were placed on the stack but (I suspect) the data was in the heap. When the function exited, it destroyed the Mat variables and released the heap data. However the iOS image code (running in another thread) still retained a pointer. The bottom part of the image memory was being over-written in the heap (when it was reallocated to something else). Anyway, I've reworked the code to keep references as necessary and the problem has gone away. Susan