• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Memory and stringByAppendingString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memory and stringByAppendingString


  • Subject: Memory and stringByAppendingString
  • From: Aidas Dailide <email@hidden>
  • Date: Sun, 18 May 2003 22:56:25 +0300

Hi,

I have a question about memory management. I still can't master it. I just can't fully understand what to do on some case. Here is one of them:
NSString* finalH=[[[[NSString alloc] initWithString:@""] autorelease] retain];
for (i=0;i<[array count];i++)
{
finalH=[finalH stringByAppendingString:[self hyphenateString:[array objectAtIndex:i]]];
finalH=[finalH stringByAppendingString:@" "];
}

Can you believe that this code can take about 100 Mb (ofcourse you can)!! Could anyone explain me (and write some example code) on how to fix this?

Thanks,

Newbie Aidas
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Memory and stringByAppendingString
      • From: Pete Yandell <email@hidden>
    • Re: Memory and stringByAppendingString
      • From: publiclook <email@hidden>
    • Re: Memory and stringByAppendingString
      • From: Just van Rossum <email@hidden>
  • Prev by Date: Re: reading a text file
  • Next by Date: Re: Memory and stringByAppendingString
  • Previous by thread: Re: [BUG] NSSelectorFromString Sometimes Lies
  • Next by thread: Re: Memory and stringByAppendingString
  • Index(es):
    • Date
    • Thread