Sometimes, when I develop an exploit that perfectly works on a given machine, it will fail on a different one, despite them having the same OS/Architecture and configurations (like language, which in my experience can have some effects on the process memory, at least on Windows).
I am aware of the fact that techniques exist to achieve more reliability in some cases. Still, I wonder if an exploit developed and tested on a given device (let's say a Google Pixel), with or without using these techniques, is supposed to work on another (like a Samsung Galaxy S8).
If not, why? Shouldn't the same binary have the same process memory? I can think of different cases in which this shouldn't be true, for example if the program loads data that are device-specific. But when it isn't the case, will the same binary, feeded with the same input, behave differently when ran on different devices?
This questions assumes that ASLR is disabled.
EDIT: I am asking about exploiting memory corruption vulnerabilities - like use-after-frees and OOB reads.