My python application reads data from files and stores these data in dictionaries during start up (dictionaries are properties of data reader classes). Once the application starts and the read data is used, these data in the dictionaries are no longer needed. However, they consume large amount of memory. How do I delete these dictionaries to free the memory?
For example:
class DataReader():
def __init__(self, data_file):
self.data_file = data_file
def read_data_file_and_store_data_in_dictionary():
self.data_dictionary = {}
for [data_name, data] in self.data_file:
self.data_dictionary[data_name] = data
class Application():
def __init__(self, data_file):
self.data_reader = DataReader()
self.data_reader.read()
def start_app(self):
self.use_read_data()
After application is started, self.data_dictionary
is no longer needed. How do I delete self.data_dictionary
permanently?