### Eclipse Workspace Patch 1.0
#P wordpress
Index: wp-admin/includes/template.php
===================================================================
--- wp-admin/includes/template.php	(revision 17501)
+++ wp-admin/includes/template.php	(working copy)
@@ -821,6 +821,15 @@
 	$u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
 	$p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
 	$bytes = apply_filters( 'upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes );
+
+	if ( function_exists( 'memory_get_usage' ) ) {
+		$current = ini_get( 'memory_limit' );
+		ini_restore( 'memory_limit' );
+		$memory_limit = ini_set( 'memory_limit',  $current );
+		$m_bytes = wp_convert_hr_to_bytes( $memory_limit );
+		$bytes = ( $m_bytes < 0 ) ? $bytes : min( $bytes, $m_bytes );
+	}
+
 	return $bytes;
 }
 
