C
C#11mo ago
reinaldyrfl

✅ Growing memory issues for ASP.NET Core App

I'm using JetBrians Rider's memory profiler. I found that my application memory growing significantly. The app pretty much pulls stock market's candlestick data, cache it via MemoryCache with SlidingExpiration of 10 minute and AbsoluteExpiration of 1 hour. That's pretty much where I think most of the memory goes to. From the profiling image below, I found that the heap generation is taking lots of space. I searched onlline and found that I should call GC.Collect() to retain memory. But this stackoverflow post says otherwise. What can I do to improve the memory usage of my application? What kind of things do I need to look for in order to make it consume less memory?
Stack Overflow
What's so wrong about using GC.Collect()?
Although I do understand the serious implications of playing with this function (or at least that's what I think), I fail to see why it's becoming one of these things that respectable programmers w...
No description
20 Replies
Jimmacle
Jimmacle11mo ago
use the view that shows you which objects are allocated it's correct that you generally don't want to call GC.Collect(), the GC runs automatically and if you have a memory leak calling that won't fix it anyway the most likely issue is that you're holding references to objects you aren't actually using anymore and preventing them from being collected
reinaldyrfl
reinaldyrflOP11mo ago
What's the name of this view?
reinaldyrfl
reinaldyrflOP11mo ago
I can't find that menu :/
Jimmacle
Jimmacle11mo ago
you may have to use dotmemory proper and not the rider integration
reinaldyrfl
reinaldyrflOP11mo ago
But anyway, how do I know that I hold references to these objects?
Jimmacle
Jimmacle11mo ago
if the GC isn't collecting them then they're being referenced somewhere
reinaldyrfl
reinaldyrflOP11mo ago
So assuming that, it means it's not something from MemoryCache being too large?
Jimmacle
Jimmacle11mo ago
it could, depending on how you're using it the profiler types view will give you some clues, or you could experiment and see what changes reduce the overall memory usage
reinaldyrfl
reinaldyrflOP11mo ago
I still can't find the profiler types view, maybe that's only on Windows. I'm on Linux.
Jimmacle
Jimmacle11mo ago
ah yeah, dotmemory is windows only
reinaldyrfl
reinaldyrflOP11mo ago
It's available on Linux as beta though But I just can't find the types view
Jimmacle
Jimmacle11mo ago
the section above the one i linked on the page might help you need to take a snapshot or 2, not sure if it works with just 1
reinaldyrfl
reinaldyrflOP11mo ago
Ah found it!
reinaldyrfl
reinaldyrflOP11mo ago
No description
reinaldyrfl
reinaldyrflOP11mo ago
This is the types view, how do I read this? I don't knokw what's EventMarker class is (on the top of the type)
Jimmacle
Jimmacle11mo ago
googling it suggests it's part of a debug tracing thing which means it might just go away if you run your project in release mode
Judes
Judes11mo ago
reinaldyrfl
reinaldyrflOP11mo ago
Yeah, my memory turns normal once I disabled Sentry's Profiling lol Thanks for the help @jIMMACLE
reinaldyrfl
reinaldyrflOP11mo ago
No description
Want results from more Discord servers?
Add your server