I suggest you analyze why the GC doesn't work well enough for you. You can use jmapto unload the heap, and then use jhateither Eclipse Memory Analyzer to find out what objects live in it. You may find yourself sticking to links that you no longer need.
GC is very smart, and you can really do something worse by trying to outwit it with your own memory management code. Try tweaking the settings, and maybe you can also try the new G1 garbage collector.
Also, remember that the GC loves short-lived, immutable objects.
source
share