Free allocated space by freeing array member in ArrayList data type