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

  • Home
  • SEARCH
  • 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 8029649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:29:46+00:00 2026-06-05T00:29:46+00:00

.h: #import <UIKit/UIKit.h> #import Todo.h @interface TodoCostApplyViewController : UIViewController { NSThread* headViewThread; NSThread* tableViewThread;

  • 0

.h:

#import <UIKit/UIKit.h>
#import "Todo.h"
@interface TodoCostApplyViewController : UIViewController

{
    NSThread* headViewThread;
    NSThread* tableViewThread;
}
@property (nonatomic, retain) NSThread* headViewThread;
@property (nonatomic, retain) NSThread* tableViewThread;
@end

.m:

@interface TodoCostApplyViewController ()
@end
- (void)viewDidLoad
{
    [super viewDidLoad];
    headViewThread = [[NSThread alloc] initWithTarget:self
                                             selector:@selector(drawHeadView)
                                               object:nil];
    [headViewThread start];
    tableViewThread = [[NSThread alloc] initWithTarget:self
                                         selector:@selector(drawTableView)
                                           object:nil];
    [tableViewThread start];   
}

- (void)dealloc
{
    [tableViewThread release];
    [headViewThread release];
}

Is there a leak of memory about tableViewThread and headViewThread ?
And if there is a leak, what should I do with this problem?
Thank you in advance!

  • 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-05T00:29:47+00:00Added an answer on June 5, 2026 at 12:29 am

    Yes, there is a potential leak. viewDidLoad can potentially be called multiple times, in which case you would see memory leaks. Everything you retain in viewDidLoad should be released (and set to nil) at the latest in viewDidUnload (and also in dealloc).

    Had you used the synthesized setters in viewDidLoad (as you should almost always do), the problem would be mitigated because every time viewDidLoad was executed, the old thread objects would get released when you assigned the new ones.

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

Sidebar

Related Questions

Say I have this code: #import <UIKit/UIKit.h> @interface MyView : UIView @end @implementation MyView
I have some codes as below #import <UIKit/UIKit.h> @interface ViewMoreSettingController : UIViewController < UITableViewDelegate,
I just create a simple UITableView in the UIViewController . .h #import <UIKit/UIKit.h> @interface
FirstViewController.h: #import <UIKit/UIKit.h> @interface FirstViewController : UIViewController { NSArray *listData; } -(IBAction) GoToInsert: (id)
UIView.h #import <UIKit/UIKit.h> #import <Foundation/Foundation.h> @interface UIView : UIResponder { IBOutlet UILabel *endLabel; IBOutlet
I created a subclass from UIView #import <UIKit/UIKit.h> @interface MeeSelectDropDownView : UIView { UILabel
I use this library: https://github.com/robbiehanson/CocoaAsyncSocket My test code: #import <UIKit/UIKit.h> @class GCDAsyncUdpSocket; @interface ThirdViewController
I made a custom cell with a XIB: .h #import <UIKit/UIKit.h> @interface TWCustomCell :
I have custom view: #import <UIKit/UIKit.h> @interface materialView : UIView { IBOutlet UIImageView *
My AppDelegate.h // // AppDelegate.h // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> {

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.