Issue
Can I clear the PC's RAM by calling some method or something like that. If this is not possible, then how could I look for unnecessary elements in memory and clear them
Solution
You can signal an intent to clear program's memory by System.gc()
. It is not guaranteed to happen the moment you call it, though, but "some time in the future".
I do not think you can access your PC's memory through Java, and if you somehow can, I think that is not supposed to happen ;)
If you want to see what is in the memory available to a Java program, you need to use a profiler (like e.g. JProfiler).
Answered By - Miki
Answer Checked By - Senaida (JavaFixing Volunteer)