Kevin Simple Kevin Simple - 1 year ago 136
C# Question

OutOfMemoryException in Custom Serialization - JSON.NET

I created my own Custom Serialization method with JSON.NET,
the method looks like :

public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
var Obj = (xObject)value;

foreach(var TargetObject in Obj)

I got an
exception at
, saying insufficient memory, any idea that I can keep my custom serialization but avoid this issue?

Note, yes, you are right,the object I'm trying to serialize is more than 1GB.

Answer Source

I found finally, the reason is because the exception from overflowing the String type from .NET. So , simply, its just too big data for a String field, there is no solution as there isn't a problem with, my solution is to simplifying my data, or output as a file on drive rather than storing its whole data any time in memory as string field, just impossible....

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download