[models] Clear raw data in manifest after it has been read

Minor optimization to save some RAM, especially for JSON manifests.
This commit is contained in:
derrod 2020-04-30 11:43:59 +02:00
parent 7dacd7ba35
commit c9392ca22c
2 changed files with 9 additions and 0 deletions

View file

@ -53,6 +53,10 @@ class JSONManifest(Manifest):
if _tmp.keys():
print(f'Did not read JSON keys: {_tmp.keys()}!')
# clear raw data after manifest has been loaded
_m.data = b''
_m.json_data = None
return _m
@classmethod

View file

@ -80,6 +80,11 @@ class Manifest:
logger.warning(f'Did not read {len(unhandled_data)} remaining bytes in manifest! '
f'This may not be a problem.')
# Throw this away since the raw data is no longer needed
_tmp.close()
del _tmp
_m.data = b''
return _m
@classmethod