psiroky opened a new issue, #798:
URL: https://github.com/apache/maven-mvnd/issues/798

   I was testing the latest bits from the `mvnd-0.10.x` branch (built locally) 
and noticed an increasing heap usage with every consequent build (of the same 
project). I am using the Quarkus project (tag 2.16.1.Final) and the simplest 
call I could think of -- just `mvnd clean`. 
   
   Here is the heap usage summary.  It went from ~100MiB to ~1.8GiB in a matter 
of 20 seconds or so. The "steps" correspond to different `mvnd clean` 
executions. My expectation would be that the heap usage goes back to the 
original number once the last execution finishes.
   
![mvnd-heap-usage](https://user-images.githubusercontent.com/670547/222926686-1108158d-341f-4802-85e6-361ae5e7f386.png)
   
   The heap dump summary looks like this:
   
![mvnd-leak-summary](https://user-images.githubusercontent.com/670547/222926820-e438256c-f0ba-4f08-a94a-75a06477f521.png)
   
   Drilling down to the biggest portion of the occupied heap, we get this:
   
![mvnd-leak-example](https://user-images.githubusercontent.com/670547/222926870-707bc46f-be6a-47aa-aae5-e46884d0493f.png)
   
   It seems like this is "caused" by the upgrade to Maven 3.9.0. I was not able 
to reproduce the same with mvnd 0.9.0, which bundles Maven 3.8.7.
   
   My investigation so far:
    * I was looking through the call tree of the biggest memory consumer (see 
above) and it looks like there is maybe some cache or so, being held via 
`ThreadLocal` and it is never cleared, accumulating data over subsequent builds
    * I stumped upon 
https://github.com/apache/maven/commit/b762fa9d5c44734b5e20eb83071e7c31821a5fad 
which changes `private MavenProject currentProject;` into `private 
ThreadLocal<MavenProject> currentProject = new ThreadLocal<>();` -- this looks 
somewhat suspicious, but I haven't yet confirmed if this the cause
   
   My environment:
   * mvnd built from branch `mvnd-0.10.x`, specifically the commit 
https://github.com/apache/maven-mvnd/commit/c65f9fe869c902cf03f859f383b2bbfe2211ff8b
    * JDK 19.0.2
    * Fedora Linux 37 (x64, kernel 6.1.14)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to