The OutOfMemoryErrorDispatcher is now lock free

The old approach relied on locks, where a lock on a static class was hold during
calling the out of memory handler. This can lead to a deadlock; you don't want
to hold a lock while calling an alien method.
Merge pull request #1678 from pveentjer/improvement/outofmemoryerrordispatcher-potentialdeadlock

The OutOfMemoryErrorDispatcher is now lock free