Subj : Re: GC questions To : Brad From : Brendan Eich Date : Thu Jun 19 2003 12:21 pm Brad wrote: > Brendan, thanks for the quick response! I will use Suspend/Resume since > these do performe blocking operations. Something like: > > myCFnx > { > ... make copies of argv[] params... > JS_SuspendContext() > > ... call blocking C code using copies of params > > JS_ResumeContext > ... assign an appropriate rval > } > Just a reminder that by using JS_GetStringBytes, you are decimating 16-bit Unicode characters (each stored in the jschar type, in a JSString's underlying storage) to 8-bit characters (stored in char). That won't do the right thing in many locales, of course. If your native (blocking C) code could use the jschars as is, then you wouldn't need to copy. You'd just need local roots (argv[i], see the gctips doc) protecting the JSStrings that own the jschar storage. But no doubt you've got good reasons to copy and transcode -- the thing is, chopping jschar down to char is not a good transcoding. Maybe you would rather convert to UTF-8, or to a multibyte, locale-specific character set encoding, if the JSStrings don't happen to contain all ASCII or ISO-Latin-1 (7- or 8-bit) characters? /be .