Problème: ini_get('memory_limit') renvoit un truc du genre 8M, or memory_get_usage() renvoit un entier (en octets), rendant toute comparaison impossible.

Solution:

function memory_get_limit() {
	$shorthands = array('K' => 1024, 'M' => 1048576);
	$memory_limit = ini_get('memory_limit');
	$parts = array();
	if (is_numeric($memory_limit)) {
		return $memory_limit;
	} elseif (preg_match('/(\d+)(K|M)/', $memory_limit, $parts)) {
		if (isset($shorthands[$parts[2]])) {
			return $parts[1] * $shorthands[$parts[2]];
		}
	}
	return false;
}