As already mentioned, see also Is $^M a leftover April Fool? for lots of related discussion.
In short, the idea seems to be that when Perl runs into an "out of memory" situation, it goes on to die (which can be trapped). Immediately before that it frees the previously allocated emergency buffer (the PV behind $^M), so any exception handler would have some memory resources to do its job of cleaning up/freeing more memory. For this kind of out-of-memory handling to be active, Perl has to be built with -DPERL_EMERGENCY_SBRK (AFAICT).
Although investigation of the sources (in particular malloc.c) confirms this theory, no one seems to have been able to come up with a short snippet demonstrating the behavior... at least not with any recent version of Perl. (I haven't tried it myself so far, but out of mere curiosity I might give it a go later, if time permits.)
In reply to Re: die rather than exit on out-of-memory failure?
by Anonyrnous Monk
in thread die rather than exit on out-of-memory failure?
by chm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |