Allocate 1MB of memory upfront. When OOM happens, free that memory and run recovery mechanism.
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.