I have a asp.net core web api hosted in azure services running on .NET 6. For a while now we have been experiencing, what seems like a memory leak in the w3wp process. Where the memory gradually expands to fill up the available memory in less than a week time, we are talking about 25 Gb memory occupied by the end of the week :0
I did memory analysis and determined that most of the memory was held up in the native heap (unmanaged memory). After some digging around in the memory dump, I found that there is a large number (millions) of blocks that are holding strings that map to api endpoints in the application
000001bb`e7d84260 ........M.A.C.H.
000001bb`e7d84270 I.N.E./.W.E.B.R.
000001bb`e7d84280 O.O.T./.A.P.P.H.
000001bb`e7d84290 O.S.T./.A.B.C.-.
000001bb`e7d842a0 P.R.O.D.-.S.Y.S.
000001bb`e7d842b0 -.T.E.S.T.I.N.-.
000001bb`e7d842c0 T.X.-.0.1./.a.p.
000001bb`e7d842d0 i./.w.e.a.t.h.e.
000001bb`e7d842e0 r.-.-.e.v.e.n.t.
000001bb`e7d842f0 s./.5.2.8.a.a.5.
000001bb`e7d84300 d.c.-.8.e.f.3.-.
000001bb`e7d84310 4.0.f.f.-.0.0.d.
000001bb`e7d84320 4.-.5.6.1.a.a.a.
000001bb`e7d84340 /.s.t.a.t.e./.0.
000001bb`e7d843a0 a.e.0.6.........
This basically is an call to endpoint /api/weather--events/528aa5dc-8ef3-40ff-00d4-00d4-561aaa/state/0ae06
It took time but I did run through a sizeable amount of the memory, and confirmed that the w3wp process is keeping in its memory millions of these values for pretty much all the incoming requests (not just GET requests but also for POST and PUT type of requests).
I have been unsuccessful to find any stack trace information in the memory dump to pin point to a module/method that is holding on to these values. So my question here is
Does ISS do any kind of caching of web requests in memory? and if anyone has any insight into how it end up holding onto this web request information indefinitely?