Hi, all. Anyone know of a tool (free or not) for hunting down objects which your code creates but never actually uses? For example: x = new MyUnusedObject(); y = new MyUsedObject(); x = y; ... I know this isn't syntactically correct, but I think you will see the idea. x object reference now points to the object pointed to by the y reference, and MyUnusedObject address space is now "orphaned". In the above example, wouldn't the orphaned MyUnusedObject memory need to be garbage-collected? If so, and if this coding mistake is done often, could be a signif performance hit. It would be nice to have a way to quickly and easily hunt these down in large code bases. A run-time hunter would be ok, but one that can scan source (or byte code) would be better. Does not have to find 100% of them, just the bulk if them. We have hundreds of thousands of lines of code, so a visual search would be inefficient use of people-time. Thoughts or ideas? Respectfully, Ben
David Weitzman
Ranch Hand
Joined: Jul 27, 2001
Posts: 1365
posted
0
PMD might do if -- if it doesn't you can write a plugin that will.
Mark Herschberg
Sheriff
Joined: Dec 04, 2000
Posts: 6035
posted
0
I think JTest does it, although I think the tool is very expensive for a very poor interface. (I'm pretty sure they have a free trial license.) Look for tools which claim white-box testing or code analysis, these tools also tend to find things like dead branches, infinite loops, etc. --Mark
saumil shukla
Ranch Hand
Joined: Dec 01, 2000
Posts: 47
posted
0
"Discover" from MKS.COM is another tool which can help you browse relationships between objects as well. Hope it helps. Saumil