This specific problem gave us lots of headache while building https://rember.com
We don't have a good solution yet. My hope is that something like content-aware memory models solve the problem at a lower level, so we don't have to worry about it at the product level.