Re: Memory management questions using UUID example
Re: Memory management questions using UUID example
- Subject: Re: Memory management questions using UUID example
- From: Brian Gilman <email@hidden>
- Date: Sun, 19 Jan 2003 12:36:44 -0500
On 1/19/03 12:24 PM, "j o a r" <email@hidden> wrote:
Joar,
Thanks for answering so quickly!! I'll read the docs you suggested below
and get up to speed!
One last question (I promise!!) I'm writing a web services application
using the CoreService/WebServices frameworks. I have a little test
application going and wanted to know if you or anyone else on the list has
played with these??
I'm looking for SOAP attachment support and cannot find it. This
probably means that it just isn't there but, I thought I'd ask the list (and
you) if I'm missing something??
Thanks in advance!!
-B
>
On Sunday, Jan 19, 2003, at 17:57 Europe/Stockholm, Brian Gilman wrote:
>
>
> Two (perhaps stupid) questions:
>
>
Yes, damn you for asking! ;)
>
>
> 1) Why do you need to cast the uuisStr twice in this method??
>
>
It could have been written like this:
>
>
+ (NSString *) uniqueString
>
{
>
CFUUIDRef uuid = CFUUIDCreate(NULL);
>
NSString *uString = (NSString *)CFUUIDCreateString(NULL, uuid);
>
CFRelease(uuid);
>
return [uString autorelease];
>
}
>
>
> 2) When you call [(NSString *)uuidStr autorelease]; does this put
>
> allow
>
> the runtime to handle reference counting??
>
>
It simply tags the autoreleased object for a delayed release. This
>
doesn't mean that it will be deallocated later, only that it will be
>
released some time in the future = the reference count will be
>
decremented some time in the future (typically after the current event
>
loop). Remember, since many objects can be retaining, "haning on", to
>
an object, releasing it doesn't mean it will be deallocated - unless
>
the reference count would happen to dip down to 0.
>
>
> I guess the real question is when do I do an [[alloc] init] and
>
> when I
>
> do an [Object* autorelease]??
>
>
Well, you alloc when you want to create an object (or some convenience
>
method does it for you), and you release, or autorelease, when you no
>
longer want to hang on to an object.
>
Read the memory management articles (below) on the difference between
>
release and autorelease, and when to use which one.
>
>
> It this the same as using dyn_pointers in C++??
>
>
Don't know.
>
>
> And, finally, is there clear, concise documentation on mem management
>
> in Cocoa??
>
>
Of course, among many others:
>
>
<file:///Developer/Documentation/Cocoa/TasksAndConcepts/
>
ProgrammingTopics/MemoryMgmt/index.html>
>
<http://www.stepwise.com/Articles/Technical/MemoryManagement.html>
>
<http://www.stepwise.com/Articles/Technical/HoldMe.html>
>
>
...and don't forget the list archives at:
>
>
<http://cocoa.mamasam.com/>
>
>
j o a r
>
_______________________________________________
>
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.