in reply to Re: die rather than exit on out-of-memory failure?
in thread die rather than exit on out-of-memory failure?

The problem is that perl exit()s rather than die()s which make recovery on failure a bit problematic.

Reducing the memory footprint of the application is a work around but in the case of PDL where the perl SV data is actually an opaque object being processed by optimized C computational kernels, it is not "relatively simple" to implement

I'm thinking that a possible approach would be to replace the implicit perl memory allocation with our own calls to the system malloc routine with the perl object reference now being controlled by magic or some such...

I'm fine with a failure to allocate these large objects but would like the perl interpreter not to exit. The current pdl_malloc using perl SVs is definitely far outside the bounds of expected perl usages. However, one of the goals of PDL was to make exactly such memory and computational performance problems accessible from perl.

  • Comment on Re^2: die rather than exit on out-of-memory failure?

Replies are listed 'Best First'.
Re^3: die rather than exit on out-of-memory failure?
by karlglazebrook (Initiate) on Jan 04, 2011 at 03:30 UTC
    Indeed. Rather than explode the spaceship, there should be a light which says 'please do not press that malloc button again'. It is relatively easy to generate such a large memory request in PDL even accidentally, by the nature of the language, And 200 Mb objects aren't much these days in the era of Gb memory computers.