This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 215159 - serious memory hogging by MavenProject's projectBuildingRequest field
Summary: serious memory hogging by MavenProject's projectBuildingRequest field
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.2
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: Milos Kleint
: 215116 215815 (view as bug list)
Depends on:
Reported: 2012-07-04 09:44 UTC by Milos Kleint
Modified: 2013-01-15 11:23 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description Milos Kleint 2012-07-04 09:44:19 UTC
by experiments with clearing the mavenProject.setProjectBuildingRequest field, I've arrived at significantly reduced number of org.apache.maven.Model instances in the running IDE which has significant consequences on memory performance.

further investigation is need what is the field used for and if it's entirely save to clear it.
Comment 1 Milos Kleint 2012-07-04 10:10:17 UTC
the only code that we use requiring the request present is MavenProject.getParent() call which is present in multiple spots in out codebase. 
getParent() throws IllegalStateException when the request is not present and on all places in our codebase we catch that exception. The result after clearing the field is that some functionality doesn't work as previously did. Mostly collateral stuff but still..
Comment 2 Milos Kleint 2012-07-04 14:05:05 UTC
another point retaining past raw models is the ModelBuildingException thrown if something goes wrong.
Comment 3 Milos Kleint 2012-07-09 11:42:21 UTC clears the ProjectBuildingRequest in MavenProject instance when loading projects. Additionally some other places calling relatively expensive code like MavenProject.getParent() or MavenEmbedder.createModelLineage are now using code that allows throwing out the object tree when not used and in some cases avoids creating the object tree altogether.
Comment 4 bht 2012-07-09 15:55:57 UTC
Perhaps it is satisfying to see that someone is waiting for this :)
See bug 214740.
Comment 5 Quality Engineering 2012-07-11 03:28:21 UTC
Integrated into 'main-golden', will be available in build *201207110002* on (upload may still be in progress)
User: Milos Kleint <>
Log: #215159, #215127 clear projectBuildingRequest from Mavenproject instance which seems to b the point effectively referencing a RepositoryCache holding multiple Model object.
Get rid of calls to MavenProject.getParent() and replace it with a method more suited for sparse invokations with throwaway results.
Introduce ModelDescription to MavenEmbedder that contains various information collected while loading project's MavenProject, allowing to reduce the number of repeated queries to the embedder environment.
Comment 6 Milos Kleint 2012-07-23 06:44:26 UTC
*** Bug 215815 has been marked as a duplicate of this bug. ***
Comment 7 Milos Kleint 2012-11-05 14:31:01 UTC
*** Bug 215116 has been marked as a duplicate of this bug. ***