in reply to Re^4: die rather than exit on out-of-memory failure?
in thread die rather than exit on out-of-memory failure?
I considered the approach of a trial malloc-then-free before any perl malloc for a given data structure. That approach would work if perl was built using the system malloc.
Perl's malloc seems to be optimized for speed rather than memory usage since for a very large malloc size (say 200MiB) the perl process would often grow by something like 400MiB. The result is that using perl's malloc when you check first, you need to check something like 2X the size you actually need to avoid perl death by malloc.
Using the system malloc should work better but it is still not foolproof and if it fails---boom goes perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: die rather than exit on out-of-memory failure?
by BrowserUk (Patriarch) on Jan 06, 2011 at 05:38 UTC |