PHP code example of rapidmail / laravel-memory

1. Go to this page and download the library: Download rapidmail/laravel-memory library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

rapidmail / laravel-memory example snippets


use RapidmailLibs\Memory\Facades\Memory;

// Get current memory usage in bytes
$usage = Memory::getMemoryUsage();

// Get real memory usage in bytes (allocated by PHP)
$realUsage = Memory::getRealMemoryUsage();

// Get PHP memory limit in bytes (or null if none is set)
$limit = Memory::getMemoryLimit();

Memory::fakeMemoryUsage(1024);
Memory::fakeRealMemoryUsage(2048);
Memory::fakeMemoryLimit('512M'); // Accepts shorthand or bytes

Memory::getMemoryUsage(); // 1024
Memory::getRealMemoryUsage(); // 2048
Memory::getMemoryLimit(); // 536870912

Memory::fakeMemoryLimit(-1);

Memory::getMemoryLimit(); // null