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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:40:15+00:00 2026-05-26T04:40:15+00:00

Reading MT documentation, I’ve seen that it is possible to release memory also implementing

  • 0

Reading MT documentation, I’ve seen that it is possible to release memory also implementing the IDisposable .NET pattern.

For example, in a custom class that extends UIViewController (MyViewController), I could override the following method:

public override void Dispose (bool disposing)
{
   if (disposing){
     // do some stuff here
   }
   base.Dispose (disposing)
}

Starting from this point, my two questions are:

  1. What type of elements do I have to release in addition to images?
  2. Do I have to call the Dispose method from an instance of MyViewController class (myViewController.Dispose()) or the Dispose method is called automatically like dealloc method?

Thank you in advance. Regards.

  • 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-26T04:40:16+00:00Added an answer on May 26, 2026 at 4:40 am

    First MonoTouch usage of IDisposable is identical to Mono or .NET. What you read about this subject elsewhere, on stackoverflow or on MSDN… will all apply here.

    What’s important wrt MonoTouch is to remember that NSObject implements IDisposable which makes a lot of sense since it represent a native object. That means that everything that inherits from NSObject, quite a large part of monotouch.dll, implements IDisposable.

    1. What type of elements do I have to release in addition to images?

    Most managed NSObject-based object instances are small but they can represent large native objects (the GC will only know about the first, managed, size).

    So it’s best to Dispose NSObject-based instances when you can, e.g. when you’re using them as local variables. The using pattern makes it easy to do so in C#.

    OTOH use your judgment, a small NSString won’t take much memory, while others could be large (or unknown, e.g. NSString GetWebPageContent (NSUrl).

    1. Do I have to call the Dispose method from an instance of MyViewController class (myViewController.Dispose()) or the Dispose method is called automatically like dealloc method?

    Part of the Dispose pattern ensure that the finalizer will call Dispose if it has not been called previously. As such the GC will, eventually, reclaim the memory (both managed and unmanaged/native) associated with those instances.

    You might want to use some tools, like Gendarme (which will run on OSX) or FxCop (Windows-only) that will report to you (for example) if some of your types have IDisposable fields that are not disposed properly.

    Disclaimer : I’m Gendarme’s maintainer 🙂

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

Sidebar

Related Questions

Reading the documentation it seems this might not be possible, but it seems that
I know from reading Microsoft documentation that the "primary" use of the IDisposable interface
After reading the documentation for MySQL Workbench I got the impression that it's possible
Reading the documentation page of BugTracker.NET BugTracker.NET API Documentation I realized that I need
I am using reading the documentation for app domains in .net 3.5 and came
Reading Kohana's documentation, I found out that the main difference in 3.0 version is
I was reading the apple documentation for memory management , and came across something
I'm new to HTML. When I started reading documentation about lists, I've noticed that
After a bit of searching and reading the documentation, it's clear that you can
Reading JBossCache documentation , there are different policies for eviction JBoss Cache also ships

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.