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 7851779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:15:48+00:00 2026-06-02T19:15:48+00:00

In my application I am removing some views from my backstack entry in my

  • 0

In my application I am removing some views from my backstack entry in my Windows phone application. My issue is that while removing the views the viewmodel corresponding to that view are not destroying.

I had written the cleanup in by backkeypress event. But in this case while removing the view from backstack this code block will not execute. So if we navigate b/w that page for 3-4 times the memory will increase and app will crash. How can I handle this situation?

  • 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-06-02T19:15:49+00:00Added an answer on June 2, 2026 at 7:15 pm

    What this problem indicates to me is that somewhere in your code you are storing a reference to your view models. For instance, are you using a factory model to construct your view models from Models? If so, when your views are destroyed, the viewmodels will stick around because the factory may still have a reference to the view models.

    I suggest you do the following:

    • Look carefully at your code, and particularly at every place where the View Model is created, or bound to a model, or stored in an array, etc.

    • If you find code that stores a reference to the view model aside from the view, then when the user navigates away from the page that the view is on, make sure you add code to also clear that reference.

    Once there are no objects in your app that reference the view model, the phone will automatically dispose of your view model, freeing up memory.

    I would say however, if you’re using enough memory that your app is crashing because view models aren’t being destroyed, you may want to look into some performance optimization towards the end of your project. View Models in most applications should not cause that kind of memory usage unless the app is used for a very long time (viewmodels should not in the course of 3-4 pages, occupy more than the app’s alloted 90MB of memory).

    Hope that helps! Try (if you can) posting some example code if you’re still stuck.

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

Sidebar

Related Questions

I just created a new web application that accepts some form based input from
I'm writing a web application that involves a continuous cycle of creating (and removing)
I have a application with a screen manager class that is causing me some
Well I'm having a bit of an issue, I have an application that uses
I wrote an application using wxWidgets that uses wxList . I am having some
I have a WinForms Application that I want to run at Mono at some
I've inherited a rather large application that really could use some cleanup. There is
At some point in the last month, two web application projects that I've been
Some time back I created a small application that uses SQL CE 4.0 database
I've got a .NET application that uses Remoting between an Administration Console and a

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.