The following code executed in order to load several large (~200MB) JSON files:
def work():
jsons = get_data()
# do something with the jsons
def get_data():
json_files = []
for json_path in file_paths_list:
json_files.append(load_json(json_path))
return json_files
def load_json(json_path):
import json
with open(json_path) as f:
return json.load(f)
This is how Pycharm's custom VM options look (up to 30GB heap size, RAM is 32GB):
# custom PyCharm VM options
-Xms25000m
-Xmx30000m
...
...
...
Popular recommendation to "Invalidate Caches/Restart" already applied.
After loading 2 files (total of ~400MB), during the 3rd, exception "MemoryError" thrown.
I cannot understand why if I have up to 30GB heap size, the memory error is thrown after only 400MB?