[webkit-help] JavaScriptCore Framework Reference

demallien demallien at me.com
Thu Dec 23 07:06:55 PST 2010


Hi Nimish,

For memory management of objects in JSCore, the best reference is here:

http://developer.apple.com/library/mac/#documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html

Of particular interest to you;
"Core Foundation functions have names that indicate when you own a returned object:
Object-creation functions that have “Create” embedded in the name;
Object-duplication functions that have “Copy” embedded in the name."

So, a string created with JSValueToStringCopy does belong to you, and does need to be released once you have finished with it.

Hope that helps.

Alli

On 23 Dec, 2010,at 04:00 PM, webkit-help-request at lists.webkit.org wrote:


I am extending The Javascript Core using the JSCore FrameWork Reference
given by Apple. (
http://developer.apple.com/library/mac/#documentation/Carbon/Reference/WebKit_JavaScriptCore_Ref/index.html
)
As of now its working fine but I have certain doubts.

1) I am using JSValueToStringCopy to create a new JSStringRef from the
JSValueRef. Now what i observe is when i run this command in a loop
(requirement to get many values)
the memory location of JSStringRef keeps on changing whereas if i use
JSStringRelease Function at the end of that loop the memory location remains
constant.
Is JSStringRelease required ? Am i wasting memory in the first case. ? It
does not give an error so it means that the memory is being managed.. but I
am worried if its managed properly or not.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20101223/222ab5dd/attachment.html>


More information about the webkit-help mailing list