Skip to content

Conversation

@davidmorgan
Copy link
Contributor

@davidmorgan davidmorgan commented Jul 22, 2025

For #4025.

The field _loadingIds is unused, remove it. This was wasting some RAM but not actually a leak as the enclosing class gets discarded/recreated every build.

LruCache maintains both a map ID->Entry and a linked list of entries. On remove, it was removing from the map but not from the list. This would cause the data to be retained longer than necessary, but only up to the max size of the cache, so it's not a full leak. It's anyway not measurable in the leak test because files are stored in RAM for testing so they are retained whether or not they are in the cache.

Update the max leak size in the leak test, as the latest analyzer version fixed the leak to do with analyzer integration.

I ran several thousand builds in watch mode with this version and don't see anything else that needs fixing; the resident size ended up larger than I'd like (~4.5GB) but the retained size was still small, under 1GB. Maybe that's something we can still improve but if so I guess it should be after moving to AOT compilation.

@github-actions
Copy link

github-actions bot commented Jul 22, 2025

PR Health

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

@davidmorgan davidmorgan changed the title Fix leak of Record. Remove unused field, fix LruCache. Jul 23, 2025
@davidmorgan davidmorgan force-pushed the fix-leak branch 2 times, most recently from 7e270c6 to fb66e4a Compare July 23, 2025 07:29
@davidmorgan davidmorgan marked this pull request as ready for review July 23, 2025 08:01
@davidmorgan davidmorgan merged commit ca1da49 into dart-lang:master Jul 23, 2025
76 checks passed
@davidmorgan davidmorgan deleted the fix-leak branch July 23, 2025 09:10
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