I have a 1.2 GB json file which when deserialized ought to give me a list with 15 mil objects.
The machine on which I'm trying to deserialize the same is a windows 2012 server(64 bit) with 16 core and 32 GB Ram.
The application has been built with target of x64.
Inspite of this when I try to read the json doc and convert it to list of objects I'm getting Out of memory exception. when I look at task manager I find that only 5GB memory has been used.
The codes i tried are as below..
a.
string plays_json = File.ReadAllText("D:\\Hun\\enplays.json");
plays = JsonConvert.DeserializeObject<List<playdata>>(plays_json);
b.
string plays_json = "";
using (var reader = new StreamReader("D:\\Hun\\enplays.json"))
{
plays_json = reader.ReadToEnd();
plays = JsonConvert.DeserializeObject<List<playdata>>(plays_json);
}
c.
using (StreamReader sr = File.OpenText("D:\\Hun\\enplays.json"))
{
StringBuilder sb = new StringBuilder();
sb.Append(sr.ReadToEnd());
plays_json = sb.ToString();
plays = JsonConvert.DeserializeObject<List<playdata>>(plays_json);
}
All help is sincerely appreciated