gnodet opened a new pull request, #1938:
URL: https://github.com/apache/maven-resolver/pull/1938

   ## Summary
   
   - **Auto-selection heuristic** (new default `"auto"` mode): estimates Path 
tree memory cost from the conflict-ID map size (`~200 bytes × nodeCount`) and 
falls back to `ClassicConflictResolver` if the parallel tree would exceed 25% 
of available heap. This prevents OOM on very large dependency graphs (e.g. 
~1000-module projects with millions of transitive nodes) while preserving the 
faster O(N) path resolver for projects that fit comfortably in memory.
   
   - **Lazy right-sized children lists**: `Path.children` starts as `null` (not 
an empty `ArrayList`) and is only initialized in `addChildren()` with exactly 
the right capacity. Leaf nodes (~60-70% of all nodes) never allocate a list at 
all, saving ~40 bytes per leaf (the `ArrayList` object header + default 
`Object[10]` backing array).
   
   - **`outOfScope` flag replaces `LinkedHashSet` partition entries**: 
`moveOutOfScope()` now sets a `boolean` flag instead of removing from a 
`LinkedHashSet`, eliminating the `HashMap.Node` overhead (~48 bytes per `Path` 
entry). Active paths are filtered at query time with a simple boolean check.
   
   ### Memory savings estimate
   
   For a graph with N nodes where ~65% are leaves:
   | Optimization | Per-node saving | Total for 5M nodes |
   |---|---|---|
   | Lazy children (leaves) | ~40 bytes | ~130 MB |
   | `outOfScope` flag | ~48 bytes | ~240 MB |
   | Right-sized ArrayList | ~40 bytes (non-leaves) | ~70 MB |
   | **Total** | | **~440 MB** |
   
   Additionally, the auto-selection heuristic avoids the full Path tree (~1 GB 
for 5M nodes) entirely when memory is tight, falling back to the in-place 
classic resolver.
   
   ## Test plan
   
   - [x] All 438 existing `maven-resolver-util` tests pass (parameterized over 
both Path and Classic resolvers)
   - [ ] CI build passes
   - [ ] Manual verification on a large multi-module project
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to