❔ What do you do to avoid memory leaks in ASP.NET?
In the attachment for example my approach. Is it correct?
5 Replies
Dunno about memory leaks (are you even experiencing them?) but the code is, in general, not great
You should inject the DbContext instead of
new
ing it up
Don't use .AddAsync()
Also pretty sure you load too much data from the database, and then filter it on client side
Hard to tell because you're using the ugly LINQ syntax
Not sure what RestClient
is either, but I assume it communicates with some API. And yet, it's not asynchronous
Also weird that you deserialize numbers you get from that API as strings, and then you use Convert
of all things to turn them into numbersallinoneapiContext
is a really weird name
and so is Crypto_Price
you shouldn't be using _
in class names, the casing already tells other devs that you've started a new wordIn general, you should stick to the language's naming conventions
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.