hmm

i now checked a compiled script what kind of properties it have.
First problem that i see is that it has a parentScopeObject that is the
scope that it used to compile against
Problem is that that is a scope really specific to one client.

So it really shouldnt hold on to that one. I can try to set that one to
null  i guess.

besides that it also has the prototype object. And that prototype object
doesnt have really stuff from our own code
But it does have NativeObject that i guess is created when calling
initStandardObject() because i see that that one has for example the
ClassCache property

also it has some internal variables like: _dcp, _id, _re i really hope those
are not used when executing the function..

So i am currently not really convinced that it is really thread save
(concurrent access or sharing of state)

johan


On Tue, Dec 9, 2008 at 10:55, Attila Szegedi <[EMAIL PROTECTED]> wrote:

> Script objects are stateless, they only represent a compiled form of the JS
> program. They can safely be shared between threads, and executed
> concurrently. Indeed, you'd probably be better off caching them, as there's
> one Java class being generted per JS function.
>
> Scopes - objects created through cx.initStandardObject() are stateful
> though, you'll need one for each Script.execute() invocation.
>
> Attila.
>
> --
> home: http://www.szegedi.org
> twitter: http://twitter.com/szegedi
> weblog: http://constc.blogspot.com
>
>
> On 2008.12.09., at 10:26, Johan Compagner wrote:
>
>  Hi,
>>
>> We use rhino also on the server and every http session has its own script
>> engine (cx.initStandardObjects(null))
>>
>> But we notice when we have let the scripts compile
>> (cx.setOptimizationLevel(9)) for very client/http sesssion that we are
>> running out of perm space
>> because of the many classes generated (and maybe not cleared fast enough
>> or
>> hold on to at some point)
>>
>> now i could build that the compile takes place and caches our scripts once
>> for every client/session.
>> But then a (compiled) script can run concurrently with others, so my
>> question is does a script has internal state like a stack pointer or other
>> data?
>> So that this cant really be done?
>>
>> johan
>>
>
>
>
>
>
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to