mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 08:38:23 +00:00
The problem: When perl runs out of memory, it outputs a generic "Out of
memory!" error and exits. This makes it hard to track down what's
happening in a complex system, especially since the message does not
even mention perl.
This patch contains two main changes:
1. vec() in lvalue context can throw fake "Out of memory!" errors when
it discovers that the index being assigned to is too big. Unlike real
allocation errors, these are trappable with try {}/eval {}.
This message has been changed to "Out of memory during vec in lvalue
context" (and since it comes from a Perl_croak() call, it will
generally have a script name and line number attached).
2. All other places in the source code that can emit "Out of memory!"
errors have been changed to attach a location identifier to the
message. For example: "Out of memory in perl:util:safesysmalloc"
This way the error message at least mentions "perl".
Fixes #21672.