Skip to content

Commit

Permalink
[144][test] Fix a memory leak regarding tests failures
Browse files Browse the repository at this point in the history
During an execution of a suite, if some fail during the failureTearDown
method execution, all the data used by these tests leak until the end of
the suite execution.
This can be problematic in case of long suite with several failures and
lot of data. It increases the risk of OutOfMemory error.

Bug: #144
  • Loading branch information
lredor authored and pcdavid committed Nov 16, 2023
1 parent 2281191 commit bbc00d7
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,9 @@ public void run() {
setErrorCatchActive(false);
setWarningCatchActive(false);

// All tearDown tasks have been done, now all fields can be safely clear (before below final checks).
new TestCaseCleaner(this).clearAllFields();

crossRefDetector.assertNoCrossReferenceAdapterFound();
checkLogs();
}
Expand Down Expand Up @@ -1924,8 +1927,6 @@ protected Color getFigureBackgroundColor(IFigure parentFigure, Class<? extends F
protected void tearDown() throws Exception {
failureTearDown();

new TestCaseCleaner(this).clearAllFields();

super.tearDown();
setErrorCatchActive(false);
setWarningCatchActive(false);
Expand Down

0 comments on commit bbc00d7

Please sign in to comment.