ASP.NET MVC 3 - WebDev Server Memory Leak Using Free NHibernate?

I have an ASP.NET MVC 3 application that has a remote MS SQL Server 2008 database connected through Fluent NHibernate. I have another application that makes various GET requests to a URL that launches a new item being added to the database. Every time an item is added, the memory of my local web server is increased by about 100 thousand.

    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");
    }

, , . 1000 1 ! , . , . - ?

+3

Source: https://habr.com/ru/post/1793179/


All Articles