in reply to Re^3: die rather than exit on out-of-memory failure?
in thread die rather than exit on out-of-memory failure?
I guess the problem with trying to fix this, would be addressing all the places in the rest of the codebase that have long been coded on the assumption that if malloc(), or whichever of the myriad wrappers is used to call it, returns, then the requested memory was available. Though I feel pretty certain I've seen plenty of code that checks the return from Newxx() etc. That said, I wouldn't expect there to be many places where large contiguous chunks of memory are allocated.
As is, the only pragmatic step the PDL authors might make would be to try calling the OS memory allocator directly for large allocations first. If the OS says okay, then give that memory back to the OS and immediately call Perl's malloc() for it. The window of cases when, the OS says yes and Perl no, should be pretty small. But that would still require action by the authors of PDL and any other similar modules that routinely allocate and manipulate large contiguous chunks of ram.
Perhaps the simplest solution would be a new module that a user program can call to check whether the process will be able to satisfy a particular allocation request. Say Devel::MemCheck::memCheck().
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: die rather than exit on out-of-memory failure?
by chm (Novice) on Jan 06, 2011 at 04:27 UTC | |
by BrowserUk (Patriarch) on Jan 06, 2011 at 05:38 UTC |