I'm loading some json files in a loop, deserialize them in a list of objects and create a temp table from the list, run a select on table (repeat this for every file): for(jsonFile : allJsonFiles){ sqlcontext.sql("select * from mainTable").filter("....).createOrReplaceTempView("table1"); sqlcontext.createDataFram(serializedObjectList, MyObject.class).createOrReplaceTempView("table2"); sqlqcontext.sql("select * from table1 join table2 ....").collectAsList(); .... } after processing 30 json files my application crashes with OOM, if i add this two line at the end of for-loop: sql.dropTempTable("table1"); sql.dropTempTable("table2"); then My app continue to process all 500 json files with no problem, I've used createOrReplaceTempView many times in my problem, should i drop temp tables everywhere to free memory? Sent using Zoho Mail