I’m handling a big arrayList in my program to create a terrain, however I want the users to be able to load their own files, so that anything you can retrieve saves or simply create terrains using a txt file. Issue is once the file is read, I ask the program to clear its contents and re-initialise the variables using a method stored in the grid class. Issue is the new grid is in fact created however space isn’t cleared in memory and memory usage goes up.
Having googled this problem I see that there is a function call to request this from Java vm but its not guaranteed, so I just wanted to see if there was any alternatives for what I’m trying to achieve.