I suggest you ...

GC.ForceCollectLargeObjectHeap

Today there isn't any way to force releasing of Large Object Heap allocated memory, a matter which causes fragments in the Handled memory heap.

41 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Shai GoldbergShai Goldberg shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
    declined  ·  Visual Studio teamAdminVisual Studio team (Product Team, Microsoft) responded  · 

    Thank you all for voting on this suggestion. We are unable to fully understand the suggestion in its current form. Please provide more details if this is something that you would like to see us consider in the future.

    Best Wishes
    Deonhe – MSFT .NET Framework Team

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Vasiliy FofanovVasiliy Fofanov commented  ·   ·  Flag as inappropriate

        We need mehod in GC like CollectLOH - Large Object Heap

        In my case I use huge lists(more >80 000 items) in a short period and after job is done I need release them from memory

        So, I need after job is done call GC.CollectLOH(). And, if it possible, GC.LOHLastModified property for control useless runs of GC.CollectLOH()

        Example:

        var _startTime = DateTime.Now;

        //do work with some huge collections

        if (GC.LOHLastModified >_startTime)
        {
        GC.CollectLOH();
        }

      • Abhishek MondalAbhishek Mondal commented  ·   ·  Flag as inappropriate

        Hello Shai,

        This is Abhishek Mondal from the CLR team and I am the PM on Garbage Collection and Core OS. I wanted to chat more with you on your scenario, which is not quie clear from the sugesstion that you have posted. Are you asking for a way to compact the large object heap ? Also what exactly do you mean by "Handled memory heap" ?

        Feel free to get in touch with me at abhishek.mondal@microsoft.com and we can discuss this further.

        Thanks,
        Abhishek Mondal
        Program Manager
        Common Language Runtime.

      Feedback and Knowledge Base