Index: wp-includes/default-constants.php
===================================================================
--- wp-includes/default-constants.php	(revision 15542)
+++ wp-includes/default-constants.php	(working copy)
@@ -35,8 +35,16 @@
 		$blog_id = 1;
 
 	// set memory limits.
-	if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
-		@ini_set('memory_limit', WP_MEMORY_LIMIT);
+	if (
+		function_exists( 'memory_get_usage' )
+		&& ( $normalize_mem = create_function( '$val', '$val = trim($val); $last = strtolower($val[strlen($val)-1]); switch($last) { case \'g\': $val *= 1024; case \'m\': $val *= 1024; case \'k\': $val *= 1024; return max(0, (int) $val);' ) )
+		&& ( $normalize_mem( @ini_get( 'memory_limit' ) ) < $normalize_mem( WP_MEMORY_LIMIT ) )
+		) {
+			@ini_set('memory_limit', WP_MEMORY_LIMIT);
+		}
+		
+	}
+	$normalize_mem = null;
 
 	if ( !defined('WP_CONTENT_DIR') )
 		define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
