Challenge here is in evaluating multiple large files.
What coding will instruct Python to "load" a limited number of files into memory, process them, garbage collect and then load the next set?
def main(directory):
"""
Create AudioAnalysis Objects from directory and call object_analysis().
"""
ff = os.listdir(directory)
for f in ff:
# can we limit the number we load at one time?
audiofile = audio.LocalAudioFile(os.path.join(directory,f)) # hungry!
Tried adding audiofile = 0
to the loop, but the memory allocation is the same.
As I understand it, Lazy Evaluation
"is an evaluation strategy which delays the evaluation of an expression until its value is needed", but in this case I need to delay evaluation until there's memory available.
Am expecting that a decorator
, descriptor
and/or use of Pythons property()
function may be involved, or possibly buffering or queueing the input.