Skip to content

mlcontext.Data.Cache is not releasing memory #6915

Open

Description

@superichmann

System Information (please complete the following information):

  • OS & Version: Windows 10]
  • ML.NET Version:ML.NET 3.0.0
  • .NET Version: .NET 8

Describe the bug
When using mlcontext.Data.Cache on idataview the memory is not released even if GC is called and null is set for the idataview and mlContext.

When not using mlcontext.Data.Cache, the memory is yes released after setting null to idataview and calling GC.

To Reproduce
Load data into idataview, DONT call cache, create model with lgbm (fit, transform test set), destroy idataviews, check memory consumption
Load data into idataview, DO call cache, create model with lgbm(fit, transform test set), destroy idataviews, check memory consumption
See the difference

Expected behavior
All memory allocated by an object which no longer can actually be used should be released
If there is a specific way to release the memory please instruct me on how to do that.
I must use mlcontext.Data.Cache since its improves performance by 50%

Activity

  1. ghost added
    untriagedNew issue has not been triaged
    on Dec 19, 2023
  2. added
    area-CoreCore ML.NET APIs and shared functionality
    on Sep 8, 2026
  3. rosebyte commented on Oct 23, 2026

    @rosebyte
    Member

    Triage: it seems we keep a reference somewhere, let's investigate.

  4. added
    bugSomething isn't working
    and removed
    untriagedNew issue has not been triaged
    on Oct 23, 2026
  5. added this to the ML.NET Future milestone on Oct 23, 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

    Labels

    area-CoreCore ML.NET APIs and shared functionalitybugSomething isn't workinggreendevelopment

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions