in reply to Re^2: die rather than exit on out-of-memory failure?
in thread die rather than exit on out-of-memory failure?
"Personally, I think that if malloc fails for a request larger than say 64k, Perl should die not exit".
This idea gets to the crux of the PDL malloc issue. In most of the run out of memory scenarios for perl, seem to assume that if you "hit the wall" in memory for one malloc, you'll fail on the next (or soon) so the interpreter cannot and must not try to get any more memory. In PDL mallocs, the problematic ones, the sizes can be upwards of 100MiB or more so the fact that the malloc failed for such a large chunk of memory has little to say about whether there is more memory available in a smaller contiguous chunk.
Reviewing this discussion (and others referenced here), it seems that what might work would be something like a fake signal $SIG{NOMEM} (generated by the perl interpreter) for which a user could install their own handler for the case that a memory allocation failed. While that might work, it seems like an ugly graft onto Perl language for such an edge case.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: die rather than exit on out-of-memory failure?
by BrowserUk (Patriarch) on Jan 05, 2011 at 13:39 UTC | |
by chm (Novice) on Jan 06, 2011 at 04:27 UTC | |
by BrowserUk (Patriarch) on Jan 06, 2011 at 05:38 UTC |