i think you asked a very sensitive question.... Ive seen quite a few threads flood with highly emotional responses about how "You can never force a GC" and "All you can do is suggest a GC".
Indeed. System.gc is the best way to go about it. But it depends on the platform. It has been known to not do anything(Quote kathy sierra and bert bates -
scjp 6 ). In most of the platforms however for a very high percentage of times, it will run the GC. I know that whenever I have tried on windows, to
test it, Ive seen it run. But this is not guaranteed. This is like saying the higher priority
thread started first will run first. Even though this is true most of the times, its not something you can rely on.