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

  • Home
  • SEARCH
  • 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 6578877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:49:38+00:00 2026-05-25T15:49:38+00:00

I’ve been having really bad memory problems with an ASP.NET Application. It seems as

  • 0

I’ve been having really bad memory problems with an ASP.NET Application. It seems as if every time the page loads, the old previous instance of the page is not removed from memory. If you press F5 ten times, the memory adds 10-20MB to the instance. During Stress and performance testing, this would max out the memory and the web server will crash…

I ran ANTS memory profiling and it confirmed that every time a page is loaded, the old instane remains in memory. All my ASP.NET Web pages uses a Master page as well. Again, if I load the page 10 times, then 10 instances of the web page exists, as well as 10 instances of the master page…

http://oi51.tinypic.com/21msy2g.jpg

Looking at the ants profiler results, you can see that every page reload adds around 320Kb to the memory, and thats just the web page, not even taking the master page into account. My application is a life insurance app that captures applications, so it goes through about 30-40 pages. So you can see why this is a masssive proble.

How would I go about finding out whats keeping the page in memory? I have no idea where to begin… :\

All my pages uses Unity and Dependency injection to register service… Not sure if I need to unregister these services after during page_onUnload.

EDIT

Okay, I’ve managed to track the issue down. The reason why the page isn’t disposed(GCollected) is because of the Unity service instances that registered but nevered unregistered during the unload of the page. This is how I’m using Unity on my page:

I inject the services through public properties

    #region Services

    [Dependency]
    public ReviewReportService SummaryService { get; set; }

    [Dependency]
    public Portfolios.PortfolioService PortfolioService { get; set; }

    #endregion

Then page init, I do the Unity Buildup:

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

                    ApplicationContainer.BuildUp(this.Context, this);
            }

Now obviously when the page goes through its normal lifecycle and calls Unload, it can’t unload because of the dependency injection reference… I’m just not sure how to unregistered the services (SummaryService, PortfolioService )

I tried calling the following in OnUnload but it does nothing:

ApplicationContainer.GetContainer(Context).Teardown(this);

  • 1 1 Answer
  • 0 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-25T15:49:39+00:00Added an answer on May 25, 2026 at 3:49 pm

    The Issue was caused by UNITY and it’s LifeTimeManager. I had to make use of a different unity LifeTimeManager that basically returns a new container every time a page does a buildup. On UnLoad of the page, teardown is called on the container and it’s disposed, which releases all links to the injected properties. This solved my problem 🙂

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm making a simple page using Google Maps API 3. My first. One marker
I have just tried to save a simple *.rtf file with some websites and

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.