diff options
author | Andreas Gohr <andi@splitbrain.org> | 2008-02-23 19:07:01 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2008-02-23 19:07:01 +0100 |
commit | 73038c47e3312b4c62c4a0a05ecd5cdcd5eb95b7 (patch) | |
tree | 8fe3dd3036ba1dc2208e0b99a69eed268d6156cb /lib/exe/fetch.php | |
parent | 7b3f8b164b5e7b432cdee1b1332ddd9f943ed8cd (diff) | |
download | rpg-73038c47e3312b4c62c4a0a05ecd5cdcd5eb95b7.tar.gz rpg-73038c47e3312b4c62c4a0a05ecd5cdcd5eb95b7.tar.bz2 |
Check memory settings on ?do
This should help with diagnosing memory related problems
darcs-hash:20080223180701-7ad00-1308829c3d7432b1d0c23c3f1acc8228c0a41e1e.gz
Diffstat (limited to 'lib/exe/fetch.php')
-rw-r--r-- | lib/exe/fetch.php | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php index f41339bdc..8087cbd07 100644 --- a/lib/exe/fetch.php +++ b/lib/exe/fetch.php @@ -425,7 +425,7 @@ function resize_imageGD($ext,$from,$from_w,$from_h,$to,$to_w,$to_h){ * Checks if the given amount of memory is available * * If the memory_get_usage() function is not available the - * function just assumes $used bytes of already allocated memory + * function just assumes $bytes of already allocated memory * * @param int $mem Size of memory you want to allocate in bytes * @param int $used already allocated memory (see above) @@ -437,28 +437,13 @@ function is_mem_available($mem,$bytes=1048576){ if(empty($limit)) return true; // no limit set! // parse limit to bytes - $unit = strtolower(substr($limit,-1)); - switch($unit){ - case 'g': - $limit = substr($limit,0,-1); - $limit *= 1024*1024*1024; - break; - case 'm': - $limit = substr($limit,0,-1); - $limit *= 1024*1024; - break; - case 'k': - $limit = substr($limit,0,-1); - $limit *= 1024; - break; - } + $limit = php_to_byte($limit); // get used memory if possible if(function_exists('memory_get_usage')){ $used = memory_get_usage(); } - if($used+$mem > $limit){ return false; } |