Skip to content

Fix memory leaks in Assembly classes - #779

Merged
danielpalme merged 1 commit into
danielpalme:mainfrom
Vovanni:fix-assembly-memory-leaks
Mar 21, 2026
Merged

Fix memory leaks in Assembly classes#779
danielpalme merged 1 commit into
danielpalme:mainfrom
Vovanni:fix-assembly-memory-leaks

Conversation

@Vovanni

@Vovanni Vovanni commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Description

Replaced ConcurrentBag with ConcurrentQueue in Assembly to fix memory leaks caused by thread-local storage in long-running threads.

Problem

ConcurrentBag maintains thread-local lists that aren't properly garbage collected after threads terminate, causing gradual memory growth in long-running applications.

Solution

Switched to ConcurrentQueue which doesn't use thread-local storage and provides more predictable memory behavior.

Changes

src/ReportGenerator.Core/Parser/Analysis/Assembly.cs:

  • Changed collection type from ConcurrentBag<Class> to ConcurrentQueue<Class> for classes;
  • Updated relevant Add operation to Enqueue pattern.

Fix memory leaks in Assembly classes
@danielpalme
danielpalme merged commit 4a6d376 into danielpalme:main Mar 21, 2026
6 checks passed
@Vovanni
Vovanni deleted the fix-assembly-memory-leaks branch April 15, 2026 21:00
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