vectorbt
vectorbt copied to clipboard
Jupiter notebook : indicators calls cause memory leak ?
hi when i run in a Jupiter notebook this cell many times the memory of python process memory keep growing.
RSI = vbt.IndicatorFactory.from_talib('RSI')
rsi = RSI.run(df['Close'], timeperiod=[14])
NATR = vbt.IndicatorFactory.from_talib('NATR')
natr = NATR.run(df['High'],df['Low'],df['Close'], timeperiod=[14])
del variable_name has no effet.
Any Idea.
Many tks
Jupyter Notebook stores each cell's output in Out variable. Re-running the same cell appends the output to this dict, that's may be a reason. I also tried running your snippet outside of Jupyter and the memory kept constant as expected. To release memory you can use del and then explicitly import gc; gc.collect(). After you do this, objects get destroyed and you won't find them in gc.get_objects().
Many tks missing the import gc; gc.collect() part. Yes i don't know why the memory keep growing after each time i run this cell in particular (+ 300 Mo per iteration).