什么是gcAllowVeryLargeObjects
在.net4.5中新增一個配置項 “gcAllowVeryLargeObjects” ,msdn解釋如下:
在64位平台上,可以允許總共大於2千兆字節的數組。(2GB)
具體說就是在.net中,List,Arrary, Dictiontry, HashSet, HashTable等列表和數組結構的對象內存可以超過2GB了。 在.net4.5之前,這些對象如果使用內存超過2GB,就會報OutOfMemoryException(內存溢出)錯誤。
如何使用?
在 ***.exe.config文件中 設置如下,如果不存在的話,可以手動創建下。
<?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <gcAllowVeryLargeObjects enabled="true" /> </runtime> </configuration>