Subj : Re: GC question: JS_GetStringBytes To : Eric Anholt From : Brendan Eich Date : Sun Aug 28 2005 12:59 am Eric Anholt wrote: > I'm one of the developers of swfdec, and we've been using the > spidermonkey code for interpreting actionscript with pretty good success > (primary complaint would be the lack of a build system outside of > mozilla that properly builds and installs shared libraries). We're taking patches ;-). There's a bug (https://bugzilla.mozilla.org/show_bug.cgi?id=97954) asking for a unified, standalone, mozilla-style autoconf build setup. Not sure this will help, but it might. What OSes are you targeting? > However, while re-reading the code I realized I was being really sloppy > with GC, and I had a couple of questions as a result: > > - I assume JS_GetStringBytes returns GCed bytes, right? What is the > guaranteed lifetime of these guys? If it's "as long as the original > stirng is rooted," I'm fine. That's it. > - What would you do if you have to maintain a stack of jsvals? I'm > using a manually rooted JS array and setting jsvals into indexes of it, > but I'm not terribly pleased with this method. You might use the interpreter's stack in the current JSContext. Anent that idea, what are these jsvals for? When do you push and pop? Can you bound the size of the stack, or of segments of it that are "chunky" enough to amortize the costs of managing the allocation and deallocation? /be .