Subj : GC questions To : netscape.public.mozilla.jseng From : "Brad DeGrazia" Date : Thu Jun 19 2003 04:12 am Currently I'm using SpiderMonkey on a single thread (no problems with it), but will be opening it up to a multi-threaded environment soon. My app uses EvaluateScript to execute scripts that mostly call defined C functions. Is it necessary to have any sort of GC protection (Begin/EndRequest) within my C functions that are called from JavaScript? I do basic things in there like extract the passed arguments from argv[] using JS_Value* and set an appropriate return value (rval) using the JS_New* functions. Also, I was looking at the Garbage Collecting tips document http://www.mozilla.org/js/spidermonkey/gctips.html and was wondering if anyone could explain how in tip #3, "argv[0] = STRING_TO_JSVAL(str1); " avoids GC problems? I see that the macro is performing a bitwise OR on the JSString* str1, but the purpose of this is beyond me. I ask this because most of my code extracts string parameters by doing something like this: CString str( JS_GetStringBytes(JS_ValueToString(argv[0])) ); After reading a bunch of posts, I'm beginning to wonder if that's a misuse of the JS_ functions. Thanks, Brad .