G
Guy
I have 6,235,099 records in my db table. Each record needs to be
converted to an XML element and outputed to a file. Since each XML
element have about 329 bytes, the resulting files will be about
2.05Gb.
I started my appliction yesterday at 5pm, and tody at 12pm, I got an
"System.OutOfMemoryException".
I read a few posts and someone wrote that the memory leaks are cause
by the type array written which are not released by the GC. So I did
this:
public override void Write(byte[] array, int offset, int count)
{
base.Write(array, offset, count);
array = null;
}
Now I am not sure wether I should call Flush(), or
CG.Collec(<something>), or use any other trick to improve performance.
There this also the mention of not passing the file path to the
FileStream ctor, but the handle? I did not got that one....
Any help would appreciated. Thanks
public class TransferXmlFile : FileStream
{
private string m_strFileNameAndPath = null;
private int m_iApplicationCount = 0;
public TransferXmlFile(string strFileNameAndPath)
: base( strFileNameAndPath, FileMode.Create)
{
m_strFileNameAndPath = strFileNameAndPath;
}
....etc
converted to an XML element and outputed to a file. Since each XML
element have about 329 bytes, the resulting files will be about
2.05Gb.
I started my appliction yesterday at 5pm, and tody at 12pm, I got an
"System.OutOfMemoryException".
I read a few posts and someone wrote that the memory leaks are cause
by the type array written which are not released by the GC. So I did
this:
public override void Write(byte[] array, int offset, int count)
{
base.Write(array, offset, count);
array = null;
}
Now I am not sure wether I should call Flush(), or
CG.Collec(<something>), or use any other trick to improve performance.
There this also the mention of not passing the file path to the
FileStream ctor, but the handle? I did not got that one....
Any help would appreciated. Thanks
public class TransferXmlFile : FileStream
{
private string m_strFileNameAndPath = null;
private int m_iApplicationCount = 0;
public TransferXmlFile(string strFileNameAndPath)
: base( strFileNameAndPath, FileMode.Create)
{
m_strFileNameAndPath = strFileNameAndPath;
}
....etc