[webkit-dev] JSxxxRelease/Retain - some guidance?

Darin Adler darin at apple.com
Thu Mar 26 12:50:58 PDT 2009


Here’s a little more beyond what Maciej said:

On Mar 26, 2009, at 8:27 AM, Patrick Mueller wrote:

> I'm familiar from Java JNI and other 'native' bindings for languages  
> for the needs of 'pinning' objects both to keep them from moving and/ 
> or keep them from being GC'd.

That’s JSValueProtect and JSValueUnprotect.

> OTOH, I know there's some kind of Release/Retain dance in the  
> ObjectiveC world as it relates to the memory management scheme of  
> using pools to manage memory. Release/Retain could be related to that.

It’s not.

> If I'm doing straight up C programming, no Cocoa, or Obj-C stuff at  
> all, do I need to worry about this stuff at all, or is there a  
> common pattern I should be using?

Yes, none of this has anything to do with Objective-C.

JSClass, JSContextGroup, JSGlobalContext, JSPropertyNameArray, and  
JSString are all reference counted, not garbage collected. The  
functions that return these objects follow the The Create Rule,  
borrowed from CoreFoundation <http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html 
 >.

     -- Darin



More information about the webkit-dev mailing list