Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • So I tried to set my php.ini to 2048M and 4096M(setting it to ‘-1’ should be infinite, but a few tests showed that ‘-1’ set’s it to 128M).
    “Wordfence Memory benchmarking utility version 6.1.12” reported that it coudnt even allocate 50M of the 90M test. So maybe that plugin is broken?
    Setting WP_MEMORY_LIMIT vars didnt do anything, only WordPress didnt work if php memory was set to a lower number than WP max.

    I found this simple script online that somewhat measures memory allocation(cant guarantee that it’s accurate. On my windows machine with a memory limit of 2048M this script could allocate 1.3Gb of memory).

    <pre>
    <?php
    function tryAlloc($megabyte){
        echo "try allocating {$megabyte} megabyte...";
        $dummy = str_repeat("-",1048576*$megabyte);
        echo "pass.";
        echo "Usage: " . memory_get_usage(true)/1048576;
        echo " Peak: " . memory_get_peak_usage(true)/1048576;
        echo "\n";
    }
    for($i=10;$i<4000;$i+=50){
        $limit = $i.'M';
        ini_set('memory_limit', $limit);
        echo "set memory_limit to {$limit}\n";
        echo "memory limit is ". ini_get("memory_limit")."\n";
        tryAlloc($i-10);
    }
    ?>
    </pre>

    placeholder

    I’ll try to replicate this bug, anything I should keep in mind?

    I suggest you read this.
    And I suggest putting WP_MAX_MEMORY_LIMIT after WP_MEMORY_LIMIT . Makes more sense 🙂

    define these variables before wp-settings.php inclusion

    EDIT: people are suggesting to set the same values in php.ini and in wp_config.php

    Thread Starter emiliskvg

    (@emiliskvg)

    Yes, that solved the issue…silly me.

Viewing 5 replies - 1 through 5 (of 5 total)