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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:40:57+00:00 2026-05-27T05:40:57+00:00

I am simple exporting my data into CSV file. But when I click on

  • 0

I am simple exporting my data into CSV file. But when I click on Export Button, Leak Instrument shows [NSPlaceholderMutableString init] error.

I have not used Placeholder anywhere in my NSMutableString, then What’s so wrong that Instrument shows Leak.

Here is my code:

- (IBAction)btnExportDataPressed:(id)sender
{
    csvString = [[NSMutableString alloc] init];
    csvString = [NSMutableString stringWithFormat:@"No.,Name,Type,MaskPAN,SwipeTime\n"];
    NSString *msg = @"";

    if (self.totalCards.count>0)
    {
        for (int i=0; i<self.totalCards.count; i++)
        {
            self.cardInfo = [self.totalCards objectAtIndex:i];
            [csvString appendString:[NSMutableString stringWithFormat:@"%d,%@ %@,%@,%@,%@\n",i+1,self.cardInfo.firstName,self.cardInfo.lastName,self.cardInfo.type,self.cardInfo.maskedPAN,self.cardInfo.swipeTime]];
        }
        NSLog(@"csvString:%@",csvString);

        NSFileManager *fileManager = [NSFileManager defaultManager];
        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *documentsDirectory = [paths objectAtIndex:0];
        NSString *fileName = [NSString stringWithFormat:@"ORANGE_BOWL_%@",[NSDate date]];

        NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.csv",fileName]];
        [fileManager createFileAtPath:fullPath contents:[csvString dataUsingEncoding:NSUTF8StringEncoding] attributes:nil];
        msg = @"Data exported successfully. Connect the device to iTunes to get the records.";
    }
    else
    {
        msg = @"No Data to Export";
    }

    [csvString release];        
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Discover Orange Bowl," message:msg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];
    [alert show];
    [alert release];
}

Below is error pic from Instrument

enter image description here

  • 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-27T05:40:57+00:00Added an answer on May 27, 2026 at 5:40 am

    There’s a memory leak right at the top of your code:

    csvString = [[NSMutableString alloc] init];
    csvString = [NSMutableString stringWithFormat:@"No.,Name,Type,MaskPAN,SwipeTime\n"];
    

    So you’re allocating memory for a mutable string (line 1) which inceases the retain count by 1, and then in line 2 you lose your pointer reference to that because you assign another string to the pointer. This will leak memory for sure; not sure if the rest of your code is doing anything else bad.

    So delete the first line — it’s useless and only serves to cause a memory leak.

    Also, your [csvString release] line looks wrong because when you last assigned something to csvstring you used [NSMutableString stringWithFormat] which doesn’t increase the retain count (and hence you shouldn’t decrease it by using release). So try removing the line that says [csvString release];.

    The Leaks tool can show slightly baffling references to object you didn’t actually use; this is caused by these objects being used internally by objects that you did use (and leak).

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

Sidebar

Related Questions

I am exporting a SELECT result to CSV via INTO OUTFILE . I have
When exporting my simple data report to Excel (Using ReportViewer in localmode) I can
I have written application that is analyzing data and writing results in CSV file.
I'm trying to export data from a multivalue database (Unidata) into MySQL. Lets say
In ASP.NET, I am exporting some data to Excel by simply binding a DataSet
I'd like a simple example of exporting a function from a C++ Windows DLL.
Simple question, but one that I've been curious about...is there a functional difference between
I need to make an excel file which would fetch data from connection to
I want to write a simple function which splits a ByteString into [ByteString] using
I would like to put data from table into highcharts piechart. The table will

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.