Freeing Java memory at a specific point in time
- by Marcus
Given this code, where we load a lot of data, write it to a file, and then run an exe..
void myMethod() {
Map stuff = createMap(); //Consumes 250 MB memory
File file = createFileInput(stuff); //Create input for exe
runExectuable(file); //Run Windows exe
}
What is the best way to release the memory consumed by stuff prior to running the exe? We don't need this in memory any more as we have dumped the data to a file for input to the exe...
Is the best method to just set stuff = null prior to runExecutable(file)?