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

Memory leak in AADL workspace build #1726

Closed
smithdtyler opened this Issue Mar 5, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@smithdtyler
Copy link

smithdtyler commented Mar 5, 2019

Summary

Java heap usage grows with each OSATE workspace build and cannot be garbage collected, eventually resulting in an OutOfMemoryException.

I created a minimum working example here: https://github.com/smithdtyler/osatememoryleaker

To run the example,

  • import com.example.osate.leaker into an Eclipse RCP/RAP workspace with OSATE installed (or with the OSATE sources).
  • Run as -> Eclipse Application
  • Import the Aircraft project (or just create it from new -> Example)
  • Run JVisualVM, select the test workspace
  • Click the button contributed by the leaker project

Watch:

screen shot 2019-03-05 at 8 49 52 am

  • OSATE Version: 2.4.0
  • Operating System: Windows 7
@smithdtyler

This comment has been minimized.

Copy link
Author

smithdtyler commented Mar 5, 2019

I have suspicions about the cause of this problem (but didn't want to pollute the top level issue description). Memory Analysis Tool (MAT) suggests a couple of likely problem spots:

156 instances of "org.eclipse.xtext.util.OnChangeEvictingCache$CacheAdapter", loaded by "org.eclipse.xtext.util" occupy 190,713,528 (64.20%) bytes. These instances are referenced from one instance of "java.util.WeakHashMap$Entry[]", loaded by ""

MAT reports this on a heap dump generated after approximately 156 calls to

 ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD,
	            new NullProgressMonitor());

@lwrage lwrage changed the title Memory leak in AADL workspace builb Memory leak in AADL workspace build Mar 5, 2019

@lwrage

This comment has been minimized.

Copy link
Contributor

lwrage commented Mar 6, 2019

@smithdtyler What happens when you run the same test on OSATE 2.3.7?

@wafflebot wafflebot bot added the in progress label Mar 8, 2019

@lwrage

This comment has been minimized.

Copy link
Contributor

lwrage commented Mar 8, 2019

It's an issue in AnnexParseUtil. It has been around for years but now is the first time it caused an OOM. AnnexParseUtil has a HashMap that caches parse results. uses a field of the value as the key!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.