[Mono-bugs] [Bug 670294] AddSubview and Garbage collection

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri May 20 21:40:55 EDT 2011



--- Comment #21 from Mohamed Azmy <azmy at ebseg.com> 2011-05-21 01:40:53 UTC ---

What i am doing now to dispose of the memory is to call the below function on
any uiviewcontroller.view 

This is clearing some memory but not all 

void DisposeAllSubViews (UIView CurrView)
     for (int i = CurrView.Subviews.Length-1; i >= 0; i--)
    if (CurrView.Subviews[i].ToString().Contains("UITextView"))
         Log("Will not Dispose of UITextView");
    else if (CurrView.Subviews[i].ToString().Contains("UIImageView"))
        UIImageView MyImgView = (UIImageView)CurrView.Subviews[i];
        if (MyImgView.Image != null )
        MyImgView.Image = null;
            Log("An Image is Disposed");
       DisposeAllSubViews (CurrView.Subviews[i]);
     CurrView.RemoveFromSuperview ();
     CurrView.Dispose ();
     CurrView = null;

any better ideas ??

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.

More information about the mono-bugs mailing list