How to free memory in Java?

Viewed 244047

Is there a way to free memory in Java, similar to C's free() function? Or is setting the object to null and relying on GC the only option?

13 Answers

A valid reason for wanting to free memory from any programm (java or not ) is to make more memory available to other programms on operating system level. If my java application is using 250MB I may want to force it down to 1MB and make the 249MB available to other apps.

Related