public static function set($limit)
    {
        if (!is_int($limit)) throw new Kwf_Exception('Limit must be an integer');
        if ($limit <= 0) throw new Kwf_Exception('Not allowed setting memory limit to: ' . $limit);

        $currentLimit = self::convertToMegabyte(ini_get('memory_limit'));
        if ($limit < (int)$currentLimit) return false;

        $value = $limit;
        $maxLimit = self::getMaxLimit();
        if ($maxLimit > 0 && $maxLimit < $limit) {
            $value = $maxLimit;
        }

        ini_set('memory_limit', $value . 'M');
        return $limit == $value;
    }
public static function set($limit)
    {
        if (!is_int($limit)) throw new Kwf_Exception('Limit must be an integer');
        if ($limit <= 0) throw new Kwf_Exception('Not allowed setting memory limit to: ' . $limit);

        $currentLimit = self::convertToMegabyte(ini_get('memory_limit'));
        if ($limit < (int)$currentLimit) return false;

        $value = $limit;
        $maxLimit = self::getMaxLimit();
        if ($maxLimit > 0 && $maxLimit < $limit) {
            $value = $maxLimit;
        }

        ini_set('memory_limit', $value . 'M');
        return $limit == $value;
    }
public static function set ( $ limit ) { if ( ! is_int ( $ limit ) ) throw new Kwf_Exception ( 'Limit must be an integer' ) ; if ( $ limit <= 0 ) throw new Kwf_Exception ( 'Not allowed setting memory limit to: ' . $ limit ) ; $ currentLimit = self :: convertToMegabyte ( ini_get ( 'memory_limit' ) ) ; if ( $ limit < ( int ) $ currentLimit ) return false ; $ value = $ limit ; $ maxLimit = self :: getMaxLimit ( ) ; if ( $ maxLimit > 0 && $ maxLimit < $ limit ) { $ value = $ maxLimit ; } ini_set ( 'memory_limit' , $ value . 'M' ) ; return $ limit == $ value ; }
Sets the memory limit in megabytes

Does not lower the limit. Considers maximum value constrained by suhosin.

@param int limit in Megabytes
@return bool Whether setting limit was successful
Sets the memory limit in megabytes