Click here to Skip to main content
16,008,175 members
Home / Discussions / C#
   

C#

 
GeneralRe: Too easy Pin
The Nightcoder21-May-08 14:08
The Nightcoder21-May-08 14:08 
AnswerRe: C# Programming Challenge - By Reelix Pin
#realJSOP20-May-08 10:35
professional#realJSOP20-May-08 10:35 
GeneralRe: C# Programming Challenge - By Reelix Pin
Ennis Ray Lynch, Jr.20-May-08 12:04
Ennis Ray Lynch, Jr.20-May-08 12:04 
GeneralRe: C# Programming Challenge - By Reelix Pin
Gareth H20-May-08 12:40
Gareth H20-May-08 12:40 
GeneralRe: C# Programming Challenge - By Reelix Pin
#realJSOP20-May-08 23:17
professional#realJSOP20-May-08 23:17 
GeneralRe: C# Programming Challenge - By Reelix Pin
Reelix20-May-08 20:00
Reelix20-May-08 20:00 
QuestionRadiobuttons binding Pin
topcatalpha20-May-08 4:54
topcatalpha20-May-08 4:54 
QuestionBinaryFormatter Serializer Out-of-Memory Exception Pin
Ian Uy20-May-08 4:54
Ian Uy20-May-08 4:54 
Good Day,

I am using BinaryFormatter to write my own file. The Formatter takes a STRUCT that I constructed and convert it to a byte array that I can write as file. However, for some strange reason, when the FILE is too large (200MB+), I get an out of memory exception. Here's the code:

public static byte[] RawSerialize(object anything)
{
    MemoryStream Stream = new MemoryStream();
    BinaryFormatter BF = new BinaryFormatter();
    BF.Serialize(Stream, anything);
    byte[] Data = Stream.ToArray();
    return Data;
}


Please note that I have 3GB ram on my system and when the OOM error was called, my memory usage was only 20%.

Is there any workaround for this?

Thanks! Wink | ;)

It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.

AnswerRe: BinaryFormatter Serializer Out-of-Memory Exception Pin
Judah Gabriel Himango20-May-08 5:03
sponsorJudah Gabriel Himango20-May-08 5:03 
GeneralRe: BinaryFormatter Serializer Out-of-Memory Exception Pin
Ian Uy20-May-08 5:20
Ian Uy20-May-08 5:20 
GeneralRe: BinaryFormatter Serializer Out-of-Memory Exception Pin
Judah Gabriel Himango20-May-08 5:45
sponsorJudah Gabriel Himango20-May-08 5:45 
QuestionHow to refresh Combo Box in data grid view? [modified] Pin
cocoonwls20-May-08 4:47
cocoonwls20-May-08 4:47 
AnswerRe: How to refresh Combo Box in data grid view? Pin
cocoonwls27-May-08 16:19
cocoonwls27-May-08 16:19 
QuestionHow to convert text files to PDF files using C#.Net Pin
Sophia Rekhi20-May-08 4:32
Sophia Rekhi20-May-08 4:32 
AnswerRe: How to convert text files to PDF files using C#.Net Pin
Judah Gabriel Himango20-May-08 4:59
sponsorJudah Gabriel Himango20-May-08 4:59 
AnswerRe: How to convert text files to PDF files using C#.Net Pin
som.nitk20-May-08 5:07
som.nitk20-May-08 5:07 
QuestionDeploying custom web parts using STSADM.exe Pin
manikandanid20-May-08 3:45
manikandanid20-May-08 3:45 
AnswerCross Post Pin
led mike20-May-08 4:30
led mike20-May-08 4:30 
GeneralRe: Cross Post Pin
manikandanid20-May-08 18:06
manikandanid20-May-08 18:06 
Question.NET 3.5 redistributable package Pin
ptr2void20-May-08 3:33
ptr2void20-May-08 3:33 
AnswerRe: .NET 3.5 redistributable package Pin
Kel_20-May-08 4:15
Kel_20-May-08 4:15 
AnswerRe: .NET 3.5 redistributable package Pin
Ed.Poore20-May-08 4:23
Ed.Poore20-May-08 4:23 
QuestionWhen is a customAttribute constructor of ... : System.Attribute called/activated Pin
petermeter20-May-08 2:46
petermeter20-May-08 2:46 
AnswerRe: When is a customAttribute constructor of ... : System.Attribute called/activated Pin
led mike20-May-08 4:26
led mike20-May-08 4:26 
GeneralRe: When is a customAttribute constructor of ... : System.Attribute called/activated Pin
petermeter20-May-08 8:52
petermeter20-May-08 8:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.