The Perl Data Language uses perl SV's to hold the numeric data (as a string). That gives the simplicity of easy allocation/free since it is done transparently by perl but a side-effect of this approach is that a failure to allocate a very large data object (say, 100s of MiB or more) can make the perl interpreter hit an OOM situation and exit() with no chance of recovery.

I've read about some emergency memory space that can be built into the perl but that seems to be for small items and static in nature. Not what you would use to guard against failure of a 200MiB data allocation. Is there any way to allocate a data region oneself in the XS code and then use that as the data part of the perl SV?

It seems like perl always needs to get its own data. The call of exit() rather than die() means that, for example, running a Perl REPL interactive shell for PDL can crash without recovery. Other suggestions and thoughts on how to handle the problem are welcome!

Thanks much,
Chris

In reply to die rather than exit on out-of-memory failure? by chm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.