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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:17:23+00:00 2026-05-31T20:17:23+00:00

I know inline code is preferable, but there’s a bunch of code that’s needed

  • 0

I know inline code is preferable, but there’s a bunch of code that’s needed to show that the problem actually occurs (such as leak detection). The project can be downloaded here:
http://www.filefactory.com/file/c40b856/n/TestPopupLeak.zip

Here’s what’s happening:

For some reason, a popup using TiltEffect causes the last instance to be in it (the last child, I guess) to leak. I have created a small POC app that shows this.

In this (the smallest repro I was able to create), you do the following:

  1. Tap the button on the screen – it’s just a button on a page.

—> Another button will appear (this button is on a popup)

  1. Tap the second button that just appeared

—-> The second button will go away.

  1. Repeat steps 1 and 2 a few times.

  2. Tap the page title a few times (this causes a GC.Collect()).

  3. Look at the output window – you will see that one instance of Grid and one instance of MyUserControl are leaking.

It looks to me like the last instance is kept in memory.

If you remove the tilt effect from the popup (comment out the lines that call TiltEffect), you will see the instances getting freed (the output window will tell you no refs are still in memory).

I have no idea why this is happening… Tried debugging into TiltEffect and it looks like all events get unhooked.

Here’s the code that brings up the popup and hides it (the rest of the code handles the memory leaks and the dumb user control):

public partial class MainPage : PhoneApplicationPage
{
    Popup popup;
    Grid grid;

    // Constructor
    public MainPage()
    {
        InitializeComponent();
    }

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        // This creates a Popup with a MyUserControl in it (wrapped in a grid).
        // MyUserControl just contains a single button that when pressed calls the .action
        // member.
        popup = new Popup();
        InstanceTracker.DebugAddObject(popup);

        grid = new Grid() { Width = 400, Height = 400 };

        // This tracks memory leaks and will output every 10 seconds what objects are
        // still alive.
        InstanceTracker.DebugAddObject(grid);

        MyUserControl control = new MyUserControl();
        control.action = () => button_Click(null, null);
        InstanceTracker.DebugAddObject(control);
        grid.Children.Add(control);

        // Comment out this line and the one below that has a similar comment 
        // to make the bug go away.
        Microsoft.Phone.Controls.TiltEffect.SetIsTiltEnabled(grid, true);

        // That's it, show the popup.
        popup.Child = grid;
        popup.IsOpen = true;
    }

    void button_Click(object sender, RoutedEventArgs e)
    {
        // Disable the tilt and close the popup. Get rid of roots.
        // Comment this out to make the problem go away.
        Microsoft.Phone.Controls.TiltEffect.SetIsTiltEnabled(popup, false);
        popup.IsOpen = false;
        popup = null;
        grid = null;
        GC.Collect();
        GC.WaitForPendingFinalizers();
        GC.Collect();
    }

    private void PageTitle_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    {
        // Collects all memory.
        GC.Collect();
        GC.WaitForPendingFinalizers();
        GC.Collect();
    }
}
  • 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-31T20:17:24+00:00Added an answer on May 31, 2026 at 8:17 pm

    Okay, the issue is with the Storyboard in the tilt effect holds a reference to the last animated object

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

Sidebar

Related Questions

There is Firebug AddOn - Inline Code Finder, but it doesn't show how many
I know there are many different standards for PHP code inline documentation. Here's what
I'm using this jQuery inline datePicker plugin sample but I don't know how to
I've got a problem with the formatting of inline code blocks within the VS2010
I learned C++ at school, but there are several things I don't know, like
I have some trouble with some inline assembly code. I know what should be
I know that the below code is a partial specialization of a class: template
How do you guys organise your javascript code? I know that it is good
<div style=width:500px;> <p>To create not a block, but an inline code span,use backticks:Press the
I know inline Javascript is frowned upon and with the new on-the-fly Javascript compressors

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.