Question

I'm not sure how useful this would be, but I thought it might be neat to visualize the objects being used in my program and which objects are being referenced from where. I'm guessing it would generate some data that would be used by a program like graphviz. Are there any tools that do this, otherwise how hard would it be to do this myself? Ideally this would work for any arbitrary program, though if necessary I could make some modifications to the code (such as to add a dumpObjects() call or whatever)

I'm interested in doing this for java, but if there are solutions for other languages please post those too.

Was it helpful?

Solution

A profiler would allow you to see what objects are created at runtime. This is the output of JProfiler for instance:

jprofiler heap walker
(source: ej-technologies.com)

OTHER TIPS

Sun have developed the VisualVM which includes memory and process profiling. It also supports plugins for technology such as OSGi.

An interesting use case would be memory analysis and optimization. This is precisely what Eclipse MAT is about. Check it out.

alt text http://dev.eclipse.org/blogs/memoryanalyzer/files/2008/05/dom_tree.gif

For visualising graph structures (including object graphs), there are lots of tools based on GraphViz: http://www.graphviz.org/

There is the Object Graph Visualizer which displays classes and objects in 3D. For now it lacks an API to automate the initialization, however it shouldn't be too difficult to add this functionality. Source code also on Github.

Edit: There is already work being done in that direction apparently: https://eprints.hsr.ch/491/

OGV

not sure if that is what you are aiming at, but doxygen will do pretty much all of that.

it will take a heap of compiling code and turn it into cross referenced html, rtf of pdf. completed will calling tree for each function and "referenced by " for each variable

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top