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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T08:50:23+00:00 2026-05-21T08:50:23+00:00

Looking at the Time Profiler instrument in Instruments, it looks like I’m not disposing

  • 0

Looking at the Time Profiler instrument in Instruments, it looks like I’m not disposing of threads after I’ve used them. The list of “All threads” grows as I do operations that start a thread.

I start my thread as follows (“thread” is local to the function):

UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;

Thread thread = new Thread(Dispatch);
thread.Start();

The Dispatch() function is:

private void Dispatch()
{
    using (NSAutoreleasePool autoreleasePool = new NSAutoreleasePool())
    {
        try
        {
            // Calls a web service.
            _workDispatcher.Dispatch();
        }
        finally
        {
            // Resets network activity indicator after thread complete.
            InvokeOnMainThread(() => { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; });
        }
    }
}

_workerDispatcher.Dispatch makes a call to a web service.

What more should I be doing to destroy the thread on completion?

The application crashes after an extended period of time – and we’re guessing it might be threads – as it launches them regularly to conduct shortish operations. I’ve read that monitoring memory usage in MonoTouch is a challenge due to garbage collection – or I’d see if memory was also being consumed (e.g. by threads remaining).

I’m using MonoTouch 3.2.5 and iOS 4.3.1 (and Instruments in Xcode 4). App needs to work on iOS 3.x, so I can’t use Grand Central Dispatch.

  • 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-21T08:50:24+00:00Added an answer on May 21, 2026 at 8:50 am

    It looks like this was a garbage collection issue. If I put a call to GC.Collect() after the thread completes, the number of threads doesn’t appear to keep growing.

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

Sidebar

Related Questions

I've got a relatively long function that's dominant in the Instruments Time Profiler. Is
I spent some time looking around, and all I could find is Jython. It's
I spent some time looking for a way of resolving my issue but with
I have spent much time looking for a special package that could run the
I have spent way too much time looking for the files owner icon to
I spent a good deal of time looking through StackOverflow, as well as Google,
I've spent some time today looking for a pure ruby library that will parse
In looking at Fuzzy Date Time Picker Control in C# .NET? Piotr Czaapla's answer
I am a long-time Mac user looking to gain a decent understanding of Windows.
Am looking for a query to sum values in a particular time duration say

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.