Skip to content

Chore: Make Resolved Graph GC-able#174

Merged
edwin-grabtaxi merged 1 commit into
grab:masterfrom
edwin-grabtaxi:make_resolved_graph_gc_able
Apr 6, 2026
Merged

Chore: Make Resolved Graph GC-able#174
edwin-grabtaxi merged 1 commit into
grab:masterfrom
edwin-grabtaxi:make_resolved_graph_gc_able

Conversation

@edwin-grabtaxi

Copy link
Copy Markdown
Collaborator

Proposed Changes

I observed the behavior of Grazel when running on large project with many variants. During Resolving Dependency phase, the heap is always slowly maxed and GC brings nothing to free the heap. Looking deeper, the whole graph of resolved component are retained because we mark them as @Input (example). This is beneficial for caching, but it keeps accumulating and block the other dependency resolution tasks, which defeats the benefit of caching altogether.

As we know the dependency resolution is written to the disk after the dependency is resolved, then we know actually the resolved graph can be GC-ed. Marking it as @Internal and remove the @Cacheabletask will make it GC-able, as it not held by gradle to be cached later. This way, when GC happen, we can freed more memory and make way for other dependency resolution tasks to run.

Also we add logHeap (can be activated by -Dgrazel.logHeap=true) to monitor the heap usage.

Testing

Issues Fixed

@edwin-grabtaxi edwin-grabtaxi merged commit 5ffb40a into grab:master Apr 6, 2026
8 checks passed
@edwin-grabtaxi edwin-grabtaxi deleted the make_resolved_graph_gc_able branch April 6, 2026 06:29
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