it seems that data is still on stack, because by default when we create ```Mat``` from user pointer then no copy data. It's strange how it works. For confidence, I suggest to assign ```oclMat``` instead of ```Mat``` inside ```if``` body.