Pointer Detective

Ben Coman proposed a new pointer analysis tool :)

greetings all, I had an itch to scratch... I find it difficult using the tree list of the standard Pointer Explorer to track down why objects aren't garbage collected. I always fear I'm not going to notice getting caught in a reference loop. So I created a tool presenting an alternative view as a directed graph. The graph incrementally builds out from the target object as you explore it. Nodes are colourised to help manage complexity. The attached snapshot is produced from evaluating the following Workspace script... testObject := 'END5'. ref1 := { testObject. nil }. ref2 := { ref1 }. ref3 := PDTestResource new heldObject: ref2. ref1 at: 2 put: ref3. "note the reference loop this creates" PointerDetective openOn: testObject. Now I expect I'm duplicating something done before, but I couldn't find anything quickly and it was an opportunity for some goal direct learning of Morphic. Thanks to Roassal an option for a spring-force layout is provided. That code was copied rather than create a dependency, and might need to be rationalized later. The code is a bit rough from hacking around learning how to make things work, but its functional, so its time to get it out in the open. For more information please refer to the repository home page... http://smalltalkhub.com/#!/~BenComan/PointerDetective cheers -ben
attachment-0001

Leave a comment