I have my object as below
public class CustomizedObject
{
public int KeyId { get; set; }
public string SomeName { get; set; }
public DateTime StartDate { get; set; }
public bool isPossible { get; set; }
//Below dictionary is hug contains more than 300k rows (300*1000)
public Dictionary<string, SomBigObject> BigObjectMap { get; set; }
}
public class SomBigObject
{
//This object has so many properties of all type (int, float, datetime, enum, double, bool)
//+ another customized user object Lists
}
I am trying to serialize this object using newtonsoft json library in C# using below settings.
var settings = new JsonSerializerSettings
{
PreserveReferencesHandling = PreserveReferencesHandling.Objects,
NullValueHandling = NullValueHandling.Ignore,
ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
Formatting = Formatting.Indented
};
var json = JsonConvert.SerializeObject(value, settings);
But it gives me Out of memory exception. If i reduce number of rows to small number like 100k rows then it works fine.
When it has given out of memory exception, my computer has still 5 GB RAM available.
After serializing this object, i want to store it in Distributed Cache (Apache Ignite).
Please let me know what alternatives i can try to resolve this issue.