I've noticed that https://www.lua.org/bugs.html#5.3.4-7 indicates that the problem has been around since 5.0, but I can't reproduce it on 5.1.4, 5.1.5 or 5.2.4. Is it a problem with the bug list entry, or am I not trying hard enough?
You are missing words : " assume that the 2nd memory allocation from now fails ", I guess you need a custom allocator to reproduce it.