ASP.NET MVC 3 - WebDev Server Leaking Memory with Fluent NHibernate? -


i have asp.net mvc 3 app has ms sql server 2008 remote database, connected via fluent nhibernate. have app making various requests url triggers new item being added database. everytime item added, local web server's memory growing 100k.

    public actionresult additem(string text)     {         using (var databasesession = new fluentdatabase().session)             using (var tx = databasesession.begintransaction())             {                 item item = databasesession                              .queryover<item>()                              .where(x => x.text == text)                              .singleordefault();                 if (item == null)                        item = new ... // initialize                  item.text = text;                  databasesession.saveorupdate(item);                 tx.commit();                 databasesession.flush();             }          return redirecttoaction("index");     } 

i know isn't ideal way add items database, test of other functionality. after 1000 calls method, server taking on 1gb of data! shortly after, run out of memory , crashes. doesn't make sense, since of items should getting garbage collected. there i'm missing here?

the easiest way find problem use memory profiler, show objects staying in memory , who's holding them:

  1. memprofiler, paid, http://memprofiler.com/

  2. clr profiler, free, microsoft clr profiler .net 4 - http://www.microsoft.com/downloads/en/details.aspx?familyid=be2d842b-fdce-4600-8d32-a3cf74fda5e1 , clr profiler .net 2 , 3.5 - http://www.microsoft.com/downloads/en/details.aspx?familyid=a362781c-3870-43be-8926-862b40aa0cd0 . , here documentation - http://msdn.microsoft.com/en-us/library/ff650691.aspx


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -