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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:11:05+00:00 2026-05-23T09:11:05+00:00

I am getting memory leak theFileName = [[responseString lastPathComponent]stringByDeletingPathExtension]; theFileName is a global variable.

  • 0

I am getting memory leak theFileName = [[responseString lastPathComponent]stringByDeletingPathExtension];

theFileName is a global variable. I have synthesized it and

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))
    {
        // Custom initialization
        theFileName = [[NSString alloc] init];
        }
    return self;
}

- (void)requestFinished:(ASIHTTPRequest *)request{

    //internally calls this function
    // Use when fetching text data
    NSString *responseString = [request responseString];
    //NSLog(@"the responsestring for download is:%@",responseString);
    theFileName = [[responseString lastPathComponent]stringByDeletingPathExtension];
    //NSLog(@"the theFileName for download is:%@",theFileName);
    //adds extension  .jpg to file name
    NSString *jpg=@".jpg";
    NSString *addjpg=[theFileName stringByAppendingString:jpg];
    //NSLog(@"append %@",addjpg);
}

Released it in dealloc.

-(void)dealloc
{
[thefileName release];
}
}
  • 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-23T09:11:05+00:00Added an answer on May 23, 2026 at 9:11 am

    Here are a few things that might help.

    1. You’re not calling super‘s dealloc method within self‘s dealloc. For example,

      - (void) dealloc
      {
      [self.theFileName release];
      [super dealloc];
      }

    2. You’re not using the getters and setters that come with synthesizing a property, and we don’t know what property you’ve used with theFileName. If you’ve got a retaining property, i.e. a statement like @property (copy) NSString * theFileName then you should use the setter so that you don’t trip up on retain counts. For example,

      • (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
        {
        if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))
        {
        // Custom initialization
        NSString * aFileName = [[NSString alloc] init];
        [self setTheFileName:aFileName];
        [aFileName release];
        }
        return self;
        }

    is better.

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

Sidebar

Related Questions

I have been getting a weird memory leak and i just pinpointed what is
I have a class for connecting with httprequests. I am getting a memory leak
HI, I am getting memory leak at NSObject allocation i.e., ContactDTO* contactDTO = [[ContactDTO
I'm getting the memory leak message upon shutdown, saying that I'm leaking 3 of
Im getting the same memory leak as I mentioned the link below. NSXMLParser Leaking
I'm trying to use the CRT memory leak detection but I keep getting the
Using Instruments, I keep on getting pointed to a memory leak with a UIImage.
I am getting memory leak at text fiels please suggest me how to resolve
When i run the instrument tool i'm getting memory leaks in the following lines,(NSString
I am getting a memory leak in my objective-C code that I don't understand.

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.