<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>BigArray&amp;lt;T&amp;gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx</link><description>I’ve received a number of queries as to why the 64-bit version of the 2.0 .Net runtime still has array maximum sizes limited to 2GB. Given that it seems to be a hot topic of late I figured a little background and a discussion of the options to get around</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: BigArray&lt;T&gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#450211</link><pubDate>Thu, 11 Aug 2005 05:02:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450211</guid><dc:creator>CN</dc:creator><description>Just one note: On a 32-bit system, I think a single object reference is size 8 (the real pointer and some reserved data for the CLR/GC). On a 64-bit system, I imagine this is 12 or even 16 bytes. Wouldn't this mean that the practical maximum index in a reference type array is actually *lower* on a 64-bit machine, compared to 32 bits? Allocating a contig chunk of memory larger than 1 GB on a 32-bit machine might be possible, and that would be enough to beat the 64-bit implementation. Of course, most references have to be null references, but it's *possible*.&lt;br&gt;&lt;br&gt;Or am I missing something here?</description></item><item><title>re: BigArray&lt;T&gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#450213</link><pubDate>Thu, 11 Aug 2005 05:19:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450213</guid><dc:creator>joshwil</dc:creator><description>A single object reference is just a pointer into the GC heap, 4 bytes on 32-bit and 8-bytes on 64-bit. You are correct in noticing that this means you can have 2x the number of slots in a maximally sized object reference array on 32-bit as you can get on 64-bit (see my previous entry on generics on 64-bit: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/joshwil/archive/2004/04/13/112598.aspx"&gt;http://blogs.msdn.com/joshwil/archive/2004/04/13/112598.aspx&lt;/a&gt;).&lt;br&gt;&lt;br&gt;However, in real world scenarios, given that the minimum object size on 32-bit is 12 bytes if you have a unique reference for every element in your array you are looking at 16 bytes per object and therefore limited to 1/2 the number of objects as you would get on 64-bit before you run our of virtual address space.&lt;br&gt;&lt;br&gt;It does make one biased twoards using arrays of primitive data types where you can instead of boxed references (e.g. ArrayList) to avoid the significantly heavier penalties that go with that practice on the 64-bit platform.</description></item><item><title>re: BigArray&lt;T&gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#450285</link><pubDate>Thu, 11 Aug 2005 08:28:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450285</guid><dc:creator>Oleg Mihailik</dc:creator><description>Oh, there is other ugly side of 2Gb limit!&lt;br&gt;&lt;br&gt;List&amp;lt;T&amp;gt; class is limited too, because it based on array internally.&lt;br&gt;&lt;br&gt;It seems fairly impractical. Why on Earth 64-bitness is supported in Framework, if BCL does not support it itself?&lt;br&gt;&lt;br&gt;I believe List&amp;lt;T&amp;gt; should follow your BigArray pattern and do workaround on 64-bit platform to support high range of indices.&lt;br&gt;&lt;br&gt;This also should be applied to other array-like classes. BitArray, for example (bit, not big). If no, support of 64-bitness stays nominative and not full-featured.</description></item><item><title>re: BigArray&lt;T&gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#450520</link><pubDate>Thu, 11 Aug 2005 22:57:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450520</guid><dc:creator>Willy Denoyette</dc:creator><description>Josh,&lt;br&gt;&lt;br&gt;Are you sure you meant 2GByte, I assume the largest array can contain 2Giga elements (the array length field being a 32 bit entity holding an int), if these elements are longs that would mean a 16 GByte array, or 8 GByte for int's, 4 GB for short's an right... 2GB for bytes. Or am I missing something here.&lt;br&gt;&lt;br&gt;Willy.&lt;br&gt;</description></item><item><title>re: BigArray&lt;T&gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#450525</link><pubDate>Thu, 11 Aug 2005 23:08:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450525</guid><dc:creator>joshwil</dc:creator><description>Willy -- &lt;br&gt;&lt;br&gt;I meant 2GB = 2 GigaBytes.&lt;br&gt;&lt;br&gt;The maximum object size in the managed heap in the 2.0 CLR (on all platforms) is 2GB. Managed arrays have to fit into that. Given this you can only fit 2Giga elements in an array where each element is 1 byte in size (e.g. an array of bytes or booleans) (however in reality the maximum is just under 2 Giga elements as there is some CLR book keeping that eats a few bytes).</description></item><item><title>re: BigArray&lt;T&gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#450527</link><pubDate>Thu, 11 Aug 2005 23:12:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450527</guid><dc:creator>joshwil</dc:creator><description>Oleg --&lt;br&gt;&lt;br&gt;I've pinged the PM who owns collections for the CLR and they will be responding re: big collections. There is always the option to implement big collections yourself or push for some crew (like the powercollections crew) to do it. Our deciding not to do it in the 2.0 CLR release came down to a number of tradeoffs that we needed to consider including&lt;br&gt; - 64-bit performance&lt;br&gt; - 32-bit performance&lt;br&gt; - ease of porting code from 32-bit to 64-bit&lt;br&gt; - trying not to bloat the BCL more than it already is.&lt;br&gt;&lt;br&gt;I would be willing to bet that most applications won't find themselves coming up against this wall for the number of elements in a particular collection and will instead find themselves overwhelmingly happy about the huge amounts of virtual address space opened up by the 64-bit platform.&lt;br&gt;&lt;br&gt;However, we are currently seriously considering what to do with the next version of the runtime re: big objects and all input is good input!</description></item><item><title>re: BigArray&lt;T&gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#450529</link><pubDate>Thu, 11 Aug 2005 23:13:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450529</guid><dc:creator>Willy Denoyette</dc:creator><description>Ok, after more carefully reading I see that the size of the object is restricted to 2GByte contiguous memory space in the managed heap (the Large Object Heap is assume), irrespective the type of object.&lt;br&gt;&lt;br&gt;Willy.&lt;br&gt;</description></item><item><title>re: BigArray&lt;T&gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#450724</link><pubDate>Fri, 12 Aug 2005 10:01:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450724</guid><dc:creator>mihailik</dc:creator><description>Thank you, Josh for description.&lt;br&gt;&lt;br&gt;For me, it seems 64-bitness in CLR v2 is early implementation. Probably, it collect real field performance data, scenarios and all kind of problems to analyze it and to resolve in next version. I hope I will see improvements in Vista version of CLR :-)&lt;br&gt;&lt;br&gt;And thanks that PM too. I guess his name is Kit :-)</description></item><item><title>re: BigArray&lt;T&gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#450851</link><pubDate>Fri, 12 Aug 2005 17:38:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450851</guid><dc:creator>joshwil</dc:creator><description>mihailik -&lt;br&gt;&lt;br&gt;I am sure that the 64-bit runtime will get better over time, however it's current implementation is pretty vetted, we've been working on it in one form or another for &amp;gt; 5 years.&lt;br&gt;&lt;br&gt;-josh</description></item><item><title>BigArray&lt;T&gt;, getting around the 2GB array size limit </title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#6526305</link><pubDate>Mon, 26 Nov 2007 09:19:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:6526305</guid><dc:creator>BigArray&lt;T&gt;, getting around the 2GB array size limit </dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://feeds.maxblog.eu/item_720001.html"&gt;http://feeds.maxblog.eu/item_720001.html&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>przemkovv&amp;#8217;s world  &amp;raquo; Blog Archive   &amp;raquo; Zarz??dzanie pami??ci?? pod Windowsem x64</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#8904316</link><pubDate>Fri, 29 Aug 2008 02:29:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8904316</guid><dc:creator>przemkovv&amp;#8217;s world  &amp;raquo; Blog Archive   &amp;raquo; Zarz??dzanie pami??ci?? pod Windowsem x64</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://przemkovv.net/2008/08/29/zarzadzanie-pamiecia-pod-windowsem-x64/"&gt;http://przemkovv.net/2008/08/29/zarzadzanie-pamiecia-pod-windowsem-x64/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Initialize the size of array but face OutOfmemoryException | keyongtech</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#9338239</link><pubDate>Sun, 18 Jan 2009 19:49:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9338239</guid><dc:creator>Initialize the size of array but face OutOfmemoryException | keyongtech</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.keyongtech.com/1194272-initialize-the-size-of-array"&gt;http://www.keyongtech.com/1194272-initialize-the-size-of-array&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Large MemoryStream &amp;gt; 2gb | keyongtech</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#9362105</link><pubDate>Thu, 22 Jan 2009 06:29:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9362105</guid><dc:creator>Large MemoryStream &amp;gt; 2gb | keyongtech</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.keyongtech.com/432376-large-memorystream-2gb"&gt;http://www.keyongtech.com/432376-large-memorystream-2gb&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>java vs .NET - egzystencjalnie :) - Strona 3 | hilpers</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450202.aspx#9370606</link><pubDate>Thu, 22 Jan 2009 23:47:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9370606</guid><dc:creator>java vs .NET - egzystencjalnie :) - Strona 3 | hilpers</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.hilpers.pl/373505-java-vs-net-egzystencjalnie/3"&gt;http://www.hilpers.pl/373505-java-vs-net-egzystencjalnie/3&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>