Skip to content

System.OutOfMemoryException while merging not so big files #783

Closed

Description

@xumix

Describe the bug
System.OutOfMemoryException while merging not so big files, trying to eat 10+ Gb in build pipeline

To Reproduce
dotnet tool install --global dotnet-reportgenerator-globaltool - newest at the moment of writing (5.5.5)

$ reportgenerator "-reports:${CI_PROJECT_DIR}/artifacts/tests/coverage_*.xml" "-targetdir:${CI_PROJECT_DIR}/artifacts/tests/merged" -reporttypes:"Cobertura;HtmlSummary"
2026-04-20T15:32:58: Arguments
2026-04-20T15:32:58:  -reports:/builds/pp/pp3/artifacts/tests/coverage_*.xml
2026-04-20T15:32:58:  -targetdir:/builds/pp/pp3/artifacts/tests/merged
2026-04-20T15:32:58:  -reporttypes:Cobertura;HtmlSummary
2026-04-20T15:33:22: Error during reading report '/builds/pp/pp3/artifacts/tests/coverage_Pp3.Companies.Tests.xml' (Size: 50.7MB): Multiple errors
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
2026-04-20T15:33:32: Error during reading report '/builds/pp/pp3/artifacts/tests/coverage_Pp3.Mailer.Tests.xml' (Size: 52MB): Multiple errors
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
2026-04-20T15:33:40: Error during reading report '/builds/pp/pp3/artifacts/tests/coverage_Pp3.Tests.xml' (Size: 61MB): Multiple errors
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.
Exception of type 'System.OutOfMemoryException' was thrown.

The files in charge: https://drive.google.com/drive/folders/1cz6Ff9E3aZTIrVffQxyeFCnyoZ5HwXnS?usp=drive_link

Activity

  1. danielpalme commented on Apr 20, 2026

    @danielpalme
    Owner

    Thanks for the sample files.

    The problem is not the size of the coverage files.

    The root cause is the following:
    Over 12.000 classes are defined in a single file (EisTypes.cs). This file is really long (145.229 lines).

    When ReportGenerator iterates over the classes, it generates arrays with coverage information for each file a class is defined in.
    12.000 times 145.229 consumes a lot of memory.

    To work around the issue you could:

    • Split the large file into a separate file for each class (I assume that the classes within this file are generated.)
    • Exclude this file from the coverage report -filefilters:-*EisTypes.cs
  2. xumix commented on Apr 21, 2026

    @xumix
    Author

    @danielpalme Unfortunately I'll not be able to split the file, will try to exclude it. Thanks!
    But anyway, the memory usage seems excessive even for 12k types file.

  3. added a commit that references this issue on Apr 26, 2026
  4. danielpalme commented on Apr 26, 2026

    @danielpalme
    Owner

    I was able to reduce the memory usage significantly for large files.
    You could try the new release 5.5.7 without the filefilters.

  5. xumix commented on Apr 26, 2026

    @xumix
    Author

    I was able to reduce the memory usage significantly for large files. You could try the new release 5.5.7 without the filefilters.

    Thank you!

  6. added a commit that references this issue on May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions