Originally posted by **th-haef** January 6, 2024
Hello,
when running subsequent measurements in a loop, my RAM is getting filled up.
We want to perform a measurement, then change something, and repeat the measurement.
How do I free all memory before starting a new measurement?
Here is a quick example to reproduce the problem:
from snAPI.Main import *
import numpy as np
sn = snAPI()
sn.getDevice()
sn.initDevice(MeasMode.T2)
sn.manipulators.clearAll()
coincidenceAll = sn.manipulators.coincidence([0,1], windowTime=2000, mode=CoincidenceMode.CountAll, keepChannels=True)
for i in range(10):
#Start the measurement
sn.unfold.measure(1000, waitFinished=True)
# Load the Data
times, channels = sn.unfold.getData()
# Get the Single and CC counts
count_sync = np.count_nonzero(channels == 0)
count_chn1 = np.count_nonzero(channels == 1)
count_cc = np.count_nonzero(channels == coincidenceAll)
# Do some changes and save the data
# do_something()
Thank you for your help
Discussed in https://github.com/PicoQuant/snAPI/discussions/12