> I want to investigate which part of my Java code is generating garbage
> objects. Is there some tool that I can use to find this out? Thank
> you in advance.
All of it? After all, once an object is no longer claimed it is
eligible for garbage collection. So, all objects eventually are
garbage.
And, any code such as:
Object a = new Object();
Object b = new Object();
b = a; // at this point the object originally created and put on the
heap when you created b is garbage.
Perhaps you need to be more specific?