Workaround 11461: avoid strict purity inference by passing null pointer to onOutOfMemoryError

As discussed in https://d.puremagic.com/issues/show_bug.cgi?id=11461, this seems the better workaround as it allows keeping the pure attribute.
I added the same to onInvalidMemorypertionError, it suffered from the same issue.