30/09/2008

SUnit loves my instances

I have been trying to find out how to get rid of dead instances, because I seem to have collected a few. I first noticed this when I ran
Fspace allInstances size
and discovered 7 instances floating around. After some digging around, I was pointed to this entry on clearing up junk.
The entry introduced me to the idea of a PointerFinder, and that helped me identify where the instances were being referenced. However, that just lead to more confusion, because they seemed to be being held by the TestRunner, even though the window was closed.
A search of the squeak wiki brought up this article, which was interesting but didn't really solve the problem because I was already following its advice - at least I thought I was!
In the end, I started a new image, filed in my code, and changed the SUnit tests to include tearDown code as well as setUp code. This seems to have solved the problem. However, the documentation suggests that this isn't necessary, so perhaps I am doing something wrong.

No comments: