3

We've recently implemented ASP.NET bundling and minification in our app.

This was supposed to make it faster... and it speeds up the download, but since it went live memory usage has gone up.

I just did a memory dump as per ASP.Net Worker Process Memory Profile Tools and looked at the results from WinDbg, and things that are eating far the most memory

00007ffd809d0ee0     4478      1676592 System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[System.Xml.XmlDictionaryString, System.Runtime.Serialization]][]
00007ffdcd9bed78    14077      1689240 System.Reflection.RuntimeParameterInfo
00007ffdcd9bbb58    44987      2159376 System.Text.StringBuilder
00007ffd81166738    80376      2572032 Microsoft.Ajax.Utilities.CssContext
00007ffdcd9b9220    41647      2867112 System.Int32[]
00007ffdcd9bf100    27654      3097248 System.Reflection.RuntimeMethodInfo
00007ffd81166600    80364      3214560 Microsoft.Ajax.Utilities.CssToken
00007ffdcd9bd1e0    11875      4132224 System.Collections.Hashtable+bucket[]
00007ffdcd9b6fc0    37793      4331968 System.Object[]
00007ffdcd9b7a98    50153      8237258 System.Char[]
0000003495080610    41499      9288392      Free
00007ffd81166868   401856      9644544 Microsoft.Ajax.Utilities.Position
00007ffdcd9b6948   520475     31605586 System.String
00007ffdcd9bc988    38797     86558836 System.Byte[]

(at the bottom of the list) are all Microsoft.Ajax.Utilities classes.

So it looks like bundling is somehow leaking memory. Are there any common reasons why this could be happening? So much of the bundling stuff happens inside black boxes it's hard to know what we're doing wrong. We call

BundleConfig.RegisterBundles(BundleTable.Bundles);

in Application_Start and that's about it, I think.

Ben Curthoys
  • 741
  • 7
  • 20
  • Having the same problem. It seems okay for jquery and such, but when it renders our kendo js scripts suddenly memory usage jumps by a half a gigabyte which makes absolutely no sense. – BVernon Jun 03 '23 at 20:04

1 Answers1

1

I have no idea if this answers your question, but I just faced a similar issue where a Styles.Render was causing memory usage to spike up and the garbage collector to work constantly.

Thankfully after a short time of investigating I noticed I had made a mistake in my BundleConfig, I was trying to use ScriptBundle for a CSS file! So I just changed it to StyleBundle and everything went back to normal.

Silly mistake on my side, but you'd think there would be some kind of exception...

Shahin Dohan
  • 6,149
  • 3
  • 41
  • 58