Allocate 1MB of memory upfront. When OOM happens, free that memory and run recovery mechanism.
No OOM recovery is fool proof. What if the OOM situation is caused by another process constantly consuming memory? As soon as you free your 1MB overhead, the other process could immediately consume it and again you're in an OOM state.
Granted, the likelyhood of this is slim, but then again, so is an OOM situation period. In the world of virtual memory and swap space, it pretty much takes a rogue process to trigger an OOM error in the first place.
Older JVM's behave in such way: in the OOM situation they runs Garbage Collection process to reclaim some unused memory. GC itself requires some memory to operate, so JVM reserves some memory to GC.
Similar policy is used in Linux for disk space: 10% of disk space is reserved for root.
PS. Linux OOMKiller already do something similar: it just kills a process to free some memory.