[webkit-help] Memory management and the C API

Allison Newman demallien at mac.com
Thu Apr 1 09:55:38 PDT 2010


>The first place to go for such information is JavaScriptCore headers. For "create" functions like JSStringCreateWithUTF8CString(), comments say "Ownership follows the Create Rule," and the rule itself is explained e.g. at <http://developer.apple.com/mac/library/documentation/corefoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html>.

Ahhh, ok. As I said in my first post, I had already read the header files (many times, and in detail). It might be helpful to modify the headers to give the link to the core foundation documentation explicitly.  I had already tried googling "The Create Rule", and well, it gave me a ton of links, none on the first page had anything to do with WebKit or CoreFoundation.  On the other hand, if the header file read "Ownership follows the CoreFoundation Create Rule", googling "CoreFoundation Create Rule" gives your link as the first response.  Is this the right list for discussing changes to the header file, or should that be done over on webkit-dev?

>
>JSStrings are not JavaScript objects, and thus aren't subject to garbage collection. The result of a "create" function needs to be released.
>
>JavaScript objects and values as created by JSObjectMake and JSValueMakeString are different (which is why there is no "create" in these functions' names). They are subject to GC, and there are no retain/release functions for these, but there are JSValueProtect() and JSValueUnrotect(). Again, there is documentation for these functions in headers.
>
Ok, thank you for the clarification.

Alli


More information about the webkit-help mailing list