Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3663392
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:31:30+00:00 2026-05-19T01:31:30+00:00

I have been developing a quite large application, and I uploaded it to my

  • 0

I have been developing a quite large application, and I uploaded it to my server some days ago. Now I have found out it has several memory leaks – Uh oh.
My server is running Windows Server 2008 on 1GB ram. When I have 0 people online, only 550-600mb is used. When one people comes online the memory starts skyrocketing, and if 3-4 people are online all 1GB ram is used.

The application is made in ASP.NET with AJAX. It has many updatepanels which runs every second and quite a lot of javascript. It uses 5-7 sessions at all times. I use LINQ to SQL as database communication.

I tried perfmon.exe on my server, and I found:

  • Gen 0 collections goes from 0% to
    100% within minutes
  • Gen 1 collections
    goes from 0% to 50% within 5 minutes
  • Gen 2 is very close to 0% at all
    times
  • Total heap bytes goes up to
    100% very fast

I also ran an analysis of my program with Visual Studio. 8% Of my total runtime is done in .ToList() methods, which properly is caused by LINQ to SQL.

My theories….

(1) Linq to SQL dataContext

This might be a crazy thing to do, but: In my data access layer I have a load of methods:

  • AddSomethingToDatabase();
  • AddSomethingElseToDatabase();
  • DeleteSomethingFromDatabase();

Each of these has the following initialization:

GameDataContext db = new GameDataContext();

Which means the above statement runes nearly every second or more.

(2) No objects implement IDisposable

I have to be honest: I have never worked with IDisposable. As far as I have read, this might be a problem.

Also, if this is the leak, which classes should implement it? I do not have any I/O work or others, only the DataContext.

(3) Loads of UpdatePanels and jQuery

I have some fear loads of updatepanels can give problems with performance, but I do not know how to check it.


So my question is: Any ideas on what the memory leak could be? Any ideas on how to find the memory leak? And any ideas on how to solve it?

I would love to hear from someone who has experience with the situation above!

Thanks,
Lars

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:31:30+00:00Added an answer on May 19, 2026 at 1:31 am

    You absolutely must ensure that IDisposable objects get Dispose called when you are done with them. The simplest way to do this is to use using:

    using (GameDataContext db = new GameDataContext())
    {
        // code that uses 'db' goes in here
    }
    
    // Dispose called when 'using' scope ends
    

    If you still have problems after doing this throughout, then profiling is needed, but fix this first since it’s a no-brainer.

    Your own objects usually only need to implement IDisposable if they encapsulate unmanaged resources for which you wish to guarantee deterministic release back to the OS, so that those resources – file handles, sockets, and so on – are not sitting around waiting for GC for an interval of time you cannot rely on.

    I don’t have an answer for your question 3), sorry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.