VBA-tools / vba-test

Add testing and TDD to VBA on Windows and Mac
MIT License
202 stars 46 forks source link

Possible memory leak? #35

Open todar opened 5 years ago

todar commented 5 years ago

Not sure if I am missing something here or if I uncovered a memory leak. I was adding a Terminate event to TestSuite and noticed it doesn't fire.

Private Sub Class_Terminate()
    Debug.Print "This should fire from TestSuite..."
    Stop
End Sub

I was trying to find out why this was being skipped over and I came across this rubberduck blog lazy-object-weak-reference.

By storing the TestCase objects in the Tests collection it seems like it stays in memory (possibly even all the TestCase objects as well then?). I don't know how to check if this actually is the case or if something else is going on preventing the event to fire.


I ran a test in which I set the collection to nothing and sure enough the Terminate event fires. Perhaps TestSuite should have it's own state of the various statuses of the tests vs holding references to all the TestCase classes?