[webkit-help] Memory management and the C API

Allison Newman demallien at mac.com
Thu Apr 1 06:04:06 PDT 2010


I'm having a little trouble getting some good information on the C API used for generating JavaScript bindings, specifically memory-management and the interaction of JavaScript objects generated in C code and the garbage collector.

For example, when I call JSStringCreateWithUTF8CString(), do I need to do a JSStringRetain() on the resulting string object? And if not, does that mean that I have to do an explicit JSStringRelease()? Are these objects subject to garbage collection at all, or do they need to be explicitly retained/released? Or does the act of doing a retain disable garbage collection on an object? If they are subject to garbage collection, when does the garbage collection run? Is it in a separate thread? 

If anyone can point me to any good information on this subject, it would be greatly appreciated.  Just for context, I've got quite a large C framework for which I have successfully generated JavaScript bindings, so I'm not asking these questions as a complete newbie - I have principally used the JavaScriptCore header files and test code as my source of information so far, as I have not yet found anything better. These questions are both for my own use, but also for a long, very detailed, tutorial on creating WebKit JavaScript bindings that I have been writing.

Alli


More information about the webkit-help mailing list