I tried to read and parse (using nlohmann library) a Json
file that is almost 90MB
using this code:
std::ifstream ifs("data.json");
json jsonFile = json::parse(ifs);
The Json
file to parse has almost 14000 array elements that need to be parsed.
when I run this code the memory usage for my program goes up till it reach 2GB
of memory! That is something very unexpected and huge for a small program like this.
How can I manage memory usage for this? Is it better to get file data using other methods and then pass it to library?