New Paste

 

Recent Pastes

Administrate




PageLines PasteBin.

PasteID: 3ar
Pasted by Memory tester, 2012-10-24 15:42:55 GMT
Expires Never
Paste size 403 b
Toggle Expand   Wrap   Raw
Copy Contents   Copy URL
 
  1. <pre>
  2. <?php 
  3. function tryAlloc( $megabyte ){
  4.     echo "try allocating {$megabyte} megabyte...";
  5.     $dummy = str_repeat( "-",1048576 * $megabyte ) ;
  6.     echo "pass.";
  7.     echo " Usage: " . memory_get_usage( true ) / 1048576; 
  8.     echo " Peak: " . memory_get_peak_usage( true ) / 1048576;
  9.     echo "\n";
  10. }   
  11. for( $i=5; $i < 1000; $i += 5 ){
  12.     tryAlloc( $i - 5 );
  13. }
  14. ?>
  15. </pre>
 
 
 

 
 
 
 
 
Written by Xan Manning, 2010.
YOU NEED FLASH!