• 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
Re: Get MD5 without crashing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get MD5 without crashing


  • Subject: Re: Get MD5 without crashing
  • From: Roland King <email@hidden>
  • Date: Tue, 04 Nov 2008 13:09:18 +0800

well no that would leak since then the crypto object wouldn't get released. Also, I don't have the documentation for SSCrypto but I'd have thought whatever the digest returns is already autoreleased, so releasing it again would be wrong.

Question is how are you calling this? Is there an autorelease pool set up somewhere which is actually getting purged? All autorelease is doing is sticking it on the autorelease pool, if nothing cleans up the pool, it'll just hang onto them forever.

What crash are you getting, are you getting out of memory or are you getting a crash because you're accessing an already freed object or freeing it twice?

Alex Heinz wrote:

You probably want [[[crypto digest:@"MD5"] hexval] autorelease]. This will add the NSString object to the autorelease pool, instead of the SSCrypto object, as you are doing now.

HTH,
Alex

On Nov 3, 2008, at 9:05 PM, Mr. Gecko wrote:

Hello I am trying to MD5 a whole bunch of strings and I choose SSCrypto for it, but for some reason, it crashes because of memory. I know it has to do with releasing, I haven't found much details on when to use release and autorelease; so this is a huge task for me to find out.
Here is my method I have made.
- (NSString *)md5:(NSString *)MD5 {
SSCrypto *crypto = [[SSCrypto alloc] init];
[crypto setClearTextWithString:MD5];


  return [[[crypto autorelease] digest:@"MD5"] hexval];
}
if you could point out what I am doing wrong, I would be great full.

Thanks,
Mr. Gecko
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Get MD5 without crashing
      • From: Alex Heinz <email@hidden>
References: 
 >Get MD5 without crashing (From: "Mr. Gecko" <email@hidden>)
 >Re: Get MD5 without crashing (From: Alex Heinz <email@hidden>)

  • Prev by Date: Re: NSPredicateEditor not updating scrollbar
  • Next by Date: Re: LaunchServices/Finder refuses to recognize my NSDocument subclass
  • Previous by thread: Re: Get MD5 without crashing
  • Next by thread: Re: Get MD5 without crashing
  • Index(es):
    • Date
    • Thread