• 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 management questions using UUID example
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Memory management questions using UUID example


  • Subject: Memory management questions using UUID example
  • From: Brian Gilman <email@hidden>
  • Date: Sun, 19 Jan 2003 11:57:09 -0500

On 1/19/03 1:33 AM, "Joseph Jones" <email@hidden> wrote:

Hello all,

Two (perhaps stupid) questions:

I'm very new to cocoa but not to c/c++. I'm still having some
conceptualization problems when it comes to memory management. Forgive me if
these questions sound stupid but, I need to clear some things up in my mind
so I don't mess things up in my own apps!!


1) Why do you need to cast the uuisStr twice in this method??
2) When you call [(NSString *)uuidStr autorelease]; does this put allow
the runtime to handle reference counting??

I guess the real question is when do I do an [[alloc] init] and when I
do an [Object* autorelease]??

It this the same as using dyn_pointers in C++?? And, finally, is there
clear, concise documentation on mem management in Cocoa??

Best,

-B

> Works like a charm.
>
> Thanx,
> joe
>
> On Saturday, January 18, 2003, at 10:11 PM, Scott Anguish wrote:
>
>>
>> On Saturday, January 18, 2003, at 11:37 PM, Joseph Jones wrote:
>>
>>> Is there a set of API's or objects in Cocoa that generate and work
>>> with UUIDs? After a LONG while of digging around I located Carbon
>>> APIs for this, but I'd like to stick to Obj C and Cocoa as much as >
>>> possible.
>>>
>>
>> I've used this category for making UUID strings
>>
>>
>> @implementation NSString(uuid)
>>
>> + (NSString *)uniqueString
>> {
>> CFUUIDRef uuid = CFUUIDCreate(NULL);
>> CFStringRef uuidStr = CFUUIDCreateString(NULL, uuid);
>> CFRelease(uuid);
>> [(NSString *)uuidStr autorelease];
>> return (NSString *)uuidStr;
>> }
>>
>> @end
> _______________________________________________
> 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.
>

--
Brian Gilman <email@hidden>
Group Leader Medical & Population Genetics Dept.
MIT/Whitehead Inst. Center for Genome Research
One Kendall Square, Bldg. 300 / Cambridge, MA 02139-1561 USA
phone +1 617 252 1069 / fax +1 617 252 1902
_______________________________________________
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 management questions using UUID example
      • From: j o a r <email@hidden>
References: 
 >Re: UUID Generation in Cocoa (From: Joseph Jones <email@hidden>)

  • Prev by Date: Color differences between images in Cocoa and Carbon?
  • Next by Date: How to kill a thread?
  • Previous by thread: Re: UUID Generation in Cocoa
  • Next by thread: Re: Memory management questions using UUID example
  • Index(es):
    • Date
    • Thread