How to delete RDataFrame and clean up memory

Good day,

here is simple example that make RAM usage really explode:

import ROOT
import os
import time

@profile
def loopDataFrame(treeName, file, cuts):
	print "Processing %s"%file
	print "Processing %s"%cuts
	df = ROOT.ROOT.RDataFrame(treeName, file)
	for cutName, cutDef in cuts.iteritems():
		df = df.Filter(cutDef)
	model = ROOT.RDF.TH1DModel("lep_0_p4.Pt()", ";p_{T} (lep_{0}) GeV;", 100, 0., 100.)
	myHisto = df.Define("myP4", "lep_0_p4.Pt()").Histo1D(model, "myP4")
	return myHisto

@profile
def main():
	file = 'merged.root'
	treeName = 'NOMINAL'

	ROOT.ROOT.EnableImplicitMT()

	cuts = {}
	for i in range(0,100):
		cuts['lePt%s'%i] = 'lep_0_p4.Pt()>%s'%i
		hist = loopDataFrame( treeName, file, cuts )
		hist.Draw()
		time.sleep(1)

	raw_input("Press Enter to continue...")

if __name__ == '__main__': main()
#EOF

Plots for only 10 iterations:

And other plot w/o calling hist.Draw():

Logs: logs.txt (3.5 KB)

Looks like @eguiraud first guess is the right one. If the script doesn’t create new jitters, there is no memory slope. However, this memory stays to be used even after the end of an executable function.
That would be awesome to have some sort of RDataFrame::Clean() or RDataFrame::Delete() method to clean up memory.