Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Garbage Collection #270

Merged
merged 1 commit into from
Dec 21, 2023
Merged

Fix Garbage Collection #270

merged 1 commit into from
Dec 21, 2023

Conversation

maarzt
Copy link
Contributor

@maarzt maarzt commented Nov 2, 2023

The unit test in GarbageCollectionTest fails currently, when executed with an enabled graphics environement.
This is because TagSetDialog, FeatureComputationDialog and PreferencesDialog are no longer disposed properly since the latest changes to the app model.

This PR fixes the problem by adding the dialog's dispose() methods to the ProjectModel.projectClosedListeners().

The WindowManager needs to take care that the dialogs are properly
disposed.
@maarzt maarzt requested a review from tinevez November 2, 2023 15:10
@maarzt
Copy link
Contributor Author

maarzt commented Nov 2, 2023

fixes #269

@tinevez
Copy link
Contributor

tinevez commented Nov 2, 2023

Hello @maarzt
Unfortunately the test still fails on my side (Mac book pro), using maven in a command line or from Eclipse.

The test that fails:

Running org.mastodon.mamut.GarbageCollectionTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 7.252 sec <<< FAILURE!
java.lang.AssertionError: The garbage collection failed to clean ModelGraph. expected null, but was:<org.mastodon.mamut.model.ModelGraph@6487f7f8>
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.failNotNull(Assert.java:756)
	at org.junit.Assert.assertNull(Assert.java:738)
	at org.mastodon.mamut.GarbageCollectionTest.testIfMastodonIsGarbageCollectable(GarbageCollectionTest.java:93)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:93)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)

@maarzt
Copy link
Contributor Author

maarzt commented Nov 3, 2023

Oh, this is a pity. I didn't expect the test to fail on other platforms. I thought the Java Swing implementation on linux would be the most unforgiving in terms a memory leaks. But the test passes on my machine. Could you please double check if everything is setup correctly?

Is your working directory clean? Did you checkout the correct "fix-garbage-collection" branch. Please make sure to run mvn clean before running the tests. (I had the problem on machine: The test was failing after I switched to the fix-garbage-collection git branch. Calling mvn clean fixed the problem. So I hope that's the same on your machine.)

@stefanhahmann Could you test if the test passes on windows?

@maarzt
Copy link
Contributor Author

maarzt commented Nov 3, 2023

Ok, @stefanhahmann did run the GarbageCollectionTest on Windows. It passes.

@tinevez I hope the test will pass on your Mac after executing "mvn clean". Worst case, the test continues to fail. This would likely mean, that there is a platform specific memory leak on Mac. We could have a video call, and try to debug the problem together. I can show you how I use the Eclipse Memory Analyzer to find memory leaks.

@tinevez tinevez merged commit 878a1c4 into dev Dec 21, 2023
@tinevez tinevez deleted the fix-garbage-collection branch December 21, 2023 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants