❔ Memory Leak Dump Analysis Local Load Test
I am using Roslyn Scripting API to evaluate expressions in my web project, there is excessive creation of roslyn script and compilation which end up memory leak. This was expected I will try better approach but I am practicing dump analysis on this one. Those are the results I load test and take dump from IIS worker. Those results indicate memory leak caused by excessive use of Microsoft.CodeAnalysis.CSharp.CSharpCompilation am I right ?
23 Replies
After a while, when almost all memory is in use, I started take responses as
System.OutOfMemoryException: Insufficient memory to continue the execution of the program. at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb) at
Dump file created with dotnet-gcdump collect -p 24480 -o D:\dmptest3 -v
when memory use is at peak
Since I am testing only the use of CSharpCompilation, its actually normal to see it at peak. How to know if its actual memory leak or just too much request ?30 MiB doesn't seem like that much
How big is the memory dump?
file itself 34MB, I am trying another run
we have performance test environment with server machines, this one I am running locally to pratice before
34 MiB is nothing.
That's not a memory leak.
How can I tell if its just too much request that cause System.OutOfMemoryException or memory leak ?
If you are getting OutOfMemory exception but are using only megabytes (not gigabytes) of memory then something else is going on. For instance, creating more than the maximum number of elements in an array.
that should be seen in dump file right
Not necessarily
how is that
if application creates excessive objects that cause memory leak, it should appear in memory dump
Consider this program:
This throws OutOfMemoryException but doesn't actually allocate anything that would show up in a memory dump.
oh okay I see
high memory usage not always indicates memory leak then, there is excessive request coming and application is just using all memory avaliable
after a while usage decrease and starts responding requests back
From what you've shown, there is no indication you are even seeing high memory usage.
What's the peak memory usage of the process?
Because the memory dump is only 300 MiB
Which is nothing.
yeah thats right
sorry for language
this one is after load test
not serving requests
I will share one when I start load testing
(load test is just multiple http requests)
IIS
response time 500ms
Looks like you are running 32-bit (x86) instead of 64-bit (x64), you should try changing that if you are seeing OutOfMemory issues.
1.680.000 K process memory usage right before OutOfMemoryException
will try with disable 32-bit on )
this is max allocation I can catch, might not be memory leak, it behaves normal right after decrease excessive request
but process still allocation memory, which should be less than that, still at the peak size
second dump file after test, allocation remains, looks like not disposed
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.