I'm not sure how this is normally done, on a large site, perhaps one
running Phorum. Occassionally a thread will have hundreds of entries,
perhaps a meg or two worth of data. You won't necessarily print all
that to the screen, but PHP has to hold it in memory. Run some
operations on it, or, more likely, have an array that you keep adding
things to, and very soon you run into the 8 meg limit that is the
default limit for PHP scripts.
How do you trap for out-of-memory errors? I want to do something like:
if (php is now using more than 8 megs) {
print "Sorry, but this operation requires more memory than PHP is
allowed.";
} else {
printOutEntryes ($allEntries);
}
PHP has a command that checks the current memory usage of PHP, but
PHP, near as I know, has no command to estimate how much the next
operation is going to drive up memory usuage.
I'm sure this problem comes up for people using Phorum, or PostNuke,
or phpSlash, or phpMyAdmin or any of a lot of programs. How is it
normally handled?
running Phorum. Occassionally a thread will have hundreds of entries,
perhaps a meg or two worth of data. You won't necessarily print all
that to the screen, but PHP has to hold it in memory. Run some
operations on it, or, more likely, have an array that you keep adding
things to, and very soon you run into the 8 meg limit that is the
default limit for PHP scripts.
How do you trap for out-of-memory errors? I want to do something like:
if (php is now using more than 8 megs) {
print "Sorry, but this operation requires more memory than PHP is
allowed.";
} else {
printOutEntryes ($allEntries);
}
PHP has a command that checks the current memory usage of PHP, but
PHP, near as I know, has no command to estimate how much the next
operation is going to drive up memory usuage.
I'm sure this problem comes up for people using Phorum, or PostNuke,
or phpSlash, or phpMyAdmin or any of a lot of programs. How is it
normally handled?
Comment