question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GC pressure in CompositionConfiguration even when loading from cache

See original GitHub issue

Targeting .NET Framework 4.7.2. First of all, I don’t understand why I see this when loading the MEF graph from disk. Why does it try to find loops when the deserialized graph obviously cannot have any loops?

I see lots of temporary allocations at CompositionConfiguration.cs(297). It’s like 100 MB of Enumerable.Where<T> that is thrown away, causing unwanted memory pressure.

I believe this can be optimized. I.e. don’t use LINQ, no matter what. If I find time, I’ll try to help out.

vs-mef-gc

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
znakeeyecommented, Jan 9, 2020

You’re right. The cache is loaded using catalogManager.LoadAsync() and then this CompositionConfiguration.Create() API is called. I guess I need to re-work my caching mechanism to avoid this when loading from cache.

0reactions
znakeeyecommented, Jan 16, 2020

Possibly. But a million enumerator allocations would certainly be of importance. We have an enormous amount of exports and imports.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Simple caching makes GC go crazy?
I've profiled both methods and the "before" version was quite faster with ~18% time spent in GC, while the "after" version spend ~88%...
Read more >
8 Techniques to Avoid GC Pressure and Improve ...
Poor memory management can hurt performance in many ways. One such effect is called GC Pressure or Memory Pressure. GC Pressure (garbage ......
Read more >
When a disk cache performs better than an in-memory cache ...
If the heaps are not compacted, then any gaps in between "live" objects (live objects are those that the GC finds to still...
Read more >
Garbage collection and cache eviction
gc () To determine whether an object is reachable, the cache starts from all known root objects (usually Query and/or Mutation ) and...
Read more >
Guidance on the usage of Compact() on a MemoryCache
Memory pressure is always the GC cleanup trigger. it doesn't matter if there is CPU load or not. Removing the items from the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found