Defined WordPress Memory Limit to Unlimited

If you search WP source code, you’ll find _MEMORY_LIMIT in wp-includes/default-constants.php

$current_limit     = @ini_get( 'memory_limit' );
$current_limit_int = wp_convert_hr_to_bytes( $current_limit );
//..
if ( ! defined( 'WP_MAX_MEMORY_LIMIT' ) ) {
    if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
        define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
    } elseif ( -1 === $current_limit_int || $current_limit_int > 268435456 /* = 256M */ ) {
        define( 'WP_MAX_MEMORY_LIMIT', $current_limit );
    } else {
        define( 'WP_MAX_MEMORY_LIMIT', '256M' );
    }
}

That second conditional says make WP_MAX_MEMORY_LIMIT be -1 if your server is set to -1.

So I’d say, yeah, it’ll work. Give’r. Do note though that $current_limit (the -1 they’ve used) might be an integer, not a string. I’m not sure if that matters. From php.net

ini_get() will return the exact string stored in the php.ini file and NOT its integer equivalent. Attempting normal arithmetic functions on these values will not have otherwise expected results. The example above shows one way to convert shorthand notation into bytes, much like how the PHP source does it.

Redardless, I’d never do it. If you have a bad script doing somthing silly like an infinite loop, you could have some weird things happen, and 128gb can get eaten quicker than you think. You’d want the script to break and preserve your server, instead of clogging and maxing it out. Especially when you have multiple sites sharing the resources. If you have any php script in WP that needs more than >256mb, that’s ridiculous.

again from php.net:

memory_limit integer
This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.

When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used.