Reduced memory useage of weight and mtry optimisation