के दौरान अजीब आउट ऑफ़ मेमोरी अपवाद मैं 1264 भौतिक मेमोरी के साथ x64 सर्वर 2003 एंटरप्राइज़ पर इस कंसोल एप्लिकेशन को चलाने के लिए VSTS2008 + C# + .NET 3.5 का उपयोग कर रहा हूं।सीरियलाइजेशन
यहां मेरा कोड है, और मुझे स्टेटमेंट बफॉर्मर निष्पादित करते समय मिलता है। सरलीकृत (स्ट्रीम, टेबल), स्मृति अपवाद से बाहर है। मैंने टास्क मैनेजर के पेरर्मेंस टैब के माध्यम से मेमोरी उपयोग की निगरानी की और मुझे लगता है कि अपवाद फेंकने पर केवल 2 जी भौतिक स्मृति का उपयोग किया जाता है, इसलिए स्मृति से बाहर नहीं होना चाहिए। :-(
कोई भी विचार क्या गलत है नेट क्रमबद्धता का कोई भी सीमाstatic DataTable MakeParentTable()
{
// Create a new DataTable.
System.Data.DataTable table = new DataTable("ParentTable");
// Declare variables for DataColumn and DataRow objects.
DataColumn column;
DataRow row;
// Create new DataColumn, set DataType,
// ColumnName and add to DataTable.
column = new DataColumn();
column.DataType = System.Type.GetType("System.Int32");
column.ColumnName = "id";
column.ReadOnly = true;
column.Unique = true;
// Add the Column to the DataColumnCollection.
table.Columns.Add(column);
// Create second column.
column = new DataColumn();
column.DataType = System.Type.GetType("System.String");
column.ColumnName = "ParentItem";
column.AutoIncrement = false;
column.Caption = "ParentItem";
column.ReadOnly = false;
column.Unique = false;
// Add the column to the table.
table.Columns.Add(column);
// Make the ID column the primary key column.
DataColumn[] PrimaryKeyColumns = new DataColumn[1];
PrimaryKeyColumns[0] = table.Columns["id"];
table.PrimaryKey = PrimaryKeyColumns;
// Create three new DataRow objects and add
// them to the DataTable
for (int i = 0; i <= 5000000; i++)
{
row = table.NewRow();
row["id"] = i;
row["ParentItem"] = "ParentItem " + i;
table.Rows.Add(row);
}
return table;
}
static void Main(string[] args)
{
DataTable table = MakeParentTable();
Stream stream = new MemoryStream();
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Serialize(stream, table); // out of memory exception here
Console.WriteLine(table.Rows.Count);
return;
}
अग्रिम धन्यवाद, जॉर्ज
पर भरोसा नहीं करना चाहिए (टिप्पणियों का जवाब दिया) –
धन्यवाद मार्क है, आपके उत्तर इतनी महान है और जवाब के रूप में मैं इसे चिह्नित किया है। सराहना करें कि क्या आप यहां अपनी वर्चुअल मेमोरी के बारे में अपनी विशेषज्ञता साझा कर सकते हैं, http://stackoverflow.com/questions/1297797/windows-32-bit-virtual-memory-page-mapping-issue – George2