Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Respuesta automática

9 views
Skip to first unread message

adria...@hotmail.com

unread,
Dec 16, 2009, 3:03:04 PM12/16/09
to dev-tech-...@lists.mozilla.org
Dear friend,
I would like to introduce a really good company that mainly do the electornic products trade.
Now the company is doing promotion,all of it's products are sold nearly as same as their cost.
It redeners the best service to customers,it provide you original products which is
good quality,and what's more,the pricewill give you a big surprise!
It is realy a good opportunity for doing shopping.Just grasp the opportunity,or there will be no more than that!
The web address: (www.) kanicn.com
 

adria...@hotmail.com

unread,
Dec 23, 2009, 3:01:53 PM12/23/09
to dev-tech-...@lists.mozilla.org

Puneet Sharma

unread,
Dec 26, 2009, 1:31:24 AM12/26/09
to dev-tech-...@lists.mozilla.org
Hi,

I am getting JS OUT OF MEMORY error from the spider monkey. In my test,
I am using run time size of 8 MB and JS context stack size as 8k.

In my stress testing of my browser, where I run parallel sessions about
100 with help automated scripts, I found that after 20 mins, it start
reporting out of memory and CPU usage reaches to 100%. Here, increase in CPU
is time function, and even after I stop session and start again with min 5
sessions parallel it shooting up to 100%.

On analyzing exe callstack, I found stack to be in JS_GC.

At first moment, I tried to check if I am leaking memory in GC by not
un-rooting JS Objects. For that, I tried to dump JS rooted vars vai
JS_MapGCRoots. But, even after long run I found that map size is same after
each execution of GC.

I have doubt, it is happening because of leak in GC, where spider
monkey's allowable limit of memory is getting exhausted after some period of
time. And to recover that memory it has to run GC, which is a probable cause
of CPU usage blast.

Pls suggest mechanism to resolve. Thanks.

Regards

Puneet

David Mandelin

unread,
Dec 28, 2009, 2:12:23 PM12/28/09
to
On 12/25/09 10:31 PM, Puneet Sharma wrote:
> Hi,

I don't know exactly what's going on but I have a few ideas that *might*
help to get more information.

> I am getting JS OUT OF MEMORY error from the spider monkey. In my test,
> I am using run time size of 8 MB and JS context stack size as 8k.

What happens if you vary these parameters? Say 2, 32, and 128MB for the
run time size, and similar variations for the context stack size?

> In my stress testing of my browser, where I run parallel sessions about
> 100 with help automated scripts,

Exactly what does that mean? 100 threads in parallel? 100 contexts on
one thread? Etc.

> I found that after 20 mins, it start reporting out of memory

And exactly what does that mean? OS out-of-memory messages? JSAPI
functions return false and JS reports out of memory?

> and CPU usage reaches to 100%. Here, increase in CPU
> is time function, and even after I stop session and start again with min 5
> sessions parallel it shooting up to 100%.
>
> On analyzing exe callstack, I found stack to be in JS_GC.

Do you know if it finishes a GC cycle? In other words, does it seem to
be stuck in an infinite loop in one GC run, or is it just running lots
of GC one after the other.

One idea that occurs to me is that maybe the heuristics for when to run
a GC get confused and it keeps GC'ing again and again.

Puneet Sharma

unread,
Dec 29, 2009, 1:39:25 AM12/29/09
to David Mandelin, dev-tech-...@lists.mozilla.org
Hi,

I have reproduced, with much better scenario.

Configuration details:
1. JS context size : 4K (this problem is independent of context size)
2. Run time size : 16K (more the runtime size more time it takes to
reproduce)

3. JS version : 1.5
4: JS Script:
function isnull{}()
5. C evaluation:

For(i = 0; i< 2000 ; i++)
JS_EvaluateScriptForPrincipals();

It seems, there is problem with definition of problem.

Now, this problem does not exist in JS 1.8. But, there is again a problem
with JS 1.8, its memory requirement for initialization
(JS_InitStandardClasses) is almost 4 times,i.e. minimum runtime size
required for just initialization is 55K, which is highly unrealistic fo
which makes it unusable for my application.


Now, there are some intermediate versions,JS 1.6 and JS 1.7, for them
mailing list has already warned about their stability, so I haven't tried
them.

Can you please suggest a patch for this defect over JS 1.5 ? Thanks.

Regards
Puneet

_______________________________________________
dev-tech-js-engine mailing list
dev-tech-...@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine

David Mandelin

unread,
Dec 30, 2009, 3:02:35 PM12/30/09
to Puneet Sharma, dev-tech-...@lists.mozilla.org
On 12/28/09 10:39 PM, Puneet Sharma wrote:
> Hi,
>
> I have reproduced, with much better scenario.
>
> Configuration details:
> 1. JS context size : 4K (this problem is independent of context size)
> 2. Run time size : 16K (more the runtime size more time it takes to
> reproduce)
>
> 3. JS version : 1.5
> 4: JS Script:
> function isnull{}()
> 5. C evaluation:
>
> For(i = 0; i< 2000 ; i++)
> JS_EvaluateScriptForPrincipals();

I tried JS 1.5 with this source code on a MacBook Pro:

-----------------------------------------------------------------
#define XP_UNIX

#include <stdio.h>
#include <string.h>
#include <jsapi.h>

int main()
{
const char *src = "function isnull{}()";
int length = strlen(src);

JSRuntime *rt = JS_NewRuntime(16 << 10);
JSContext *cx = JS_NewContext(rt, 4 << 10);
JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);

jsval rv;

int i;
for (i = 0; i < 2000; i++) {
JS_EvaluateScript(cx, obj, src, length, "a", 1, &rv);
}

return 0;
}
-----------------------------------------------------------------

I didn't get any problem. Are you running on a device with small memory?
Is it possible that it is thrashing in some way because it's using too
much memory, or that it is running out of memory constantly and thus
having to do GC over and over?

David Mandelin

unread,
Dec 30, 2009, 3:02:35 PM12/30/09
to Puneet Sharma, dev-tech-...@lists.mozilla.org
On 12/28/09 10:39 PM, Puneet Sharma wrote:
> Hi,
>
> I have reproduced, with much better scenario.
>
> Configuration details:
> 1. JS context size : 4K (this problem is independent of context size)
> 2. Run time size : 16K (more the runtime size more time it takes to
> reproduce)
>
> 3. JS version : 1.5
> 4: JS Script:
> function isnull{}()
> 5. C evaluation:
>
> For(i = 0; i< 2000 ; i++)
> JS_EvaluateScriptForPrincipals();

I tried JS 1.5 with this source code on a MacBook Pro:

-----------------------------------------------------------------
#define XP_UNIX

#include <stdio.h>
#include <string.h>
#include <jsapi.h>

int main()
{
const char *src = "function isnull{}()";
int length = strlen(src);

JSRuntime *rt = JS_NewRuntime(16 << 10);
JSContext *cx = JS_NewContext(rt, 4 << 10);
JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);

jsval rv;

int i;
for (i = 0; i < 2000; i++) {
JS_EvaluateScript(cx, obj, src, length, "a", 1, &rv);
}

return 0;
}
-----------------------------------------------------------------

I didn't get any problem. Are you running on a device with small memory?
Is it possible that it is thrashing in some way because it's using too
much memory, or that it is running out of memory constantly and thus
having to do GC over and over?

> It seems, there is problem with definition of problem.

Puneet Sharma

unread,
Dec 31, 2009, 3:13:14 AM12/31/09
to David Mandelin, dev-tech-...@lists.mozilla.org
Hi,

I would like to correct your testcase for required checks and have
corrected my mistake as well.


#define XP_UNIX

#include <stdio.h>
#include <string.h>
#include <jsapi.h>


Void TestJSEngineEcmaErrorReporter
(
JSContext * hdlCtx,
Const char * pszMessage,
JSErrorReport *pstReport
)
{
Printf("\r\n Error reported : %s",pszMessage);
}


int main()
{
// puneet : it was typo const char *src = "function isnull{}()";
//correct one is : isnull(){} instead of isnull{}()
const char *src = "function isnull(){}";
int length = strlen(src);

JSRuntime *rt = JS_NewRuntime(16 << 10);
JSContext *cx = JS_NewContext(rt, 4 << 10);
JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);
jsval rv;

JSBool rc;
int i;

/*log all JS errors*/
(void)JS_SetErrorReporter(cx, TestJSEngineEcmaErrorReporter);

/* usually problem occurs*/


for (i = 0; i < 2000; i++) {

rc = JS_EvaluateScript(cx, obj, src, length, "a", 1, &rv);
if (rc == JS_FALSE)
{
printf("\r\n Error while processing EvaluateScript ");
break;
}
}

JS_DestroyContext(cx);
JS_DestroyRuntime(rt);

return 0;

Puneet Sharma

unread,
Jan 4, 2010, 7:42:13 AM1/4/10
to David Mandelin, dev-tech-...@lists.mozilla.org
Hi David,

This problem is consistently reproducible with Spidermonkey version of
JS 1.5, JS 1.6 and JS 1.7. The only variable is the loop count.
Platforms : Windows and Suse10Sp2

Same is reproducible with only JS_CompileScript API also.

JS 1.8Rc1 does not seems to have this problem, but I am not able to
find list of change logs for JS 1.8RC1. Seems Mozilla has maintained change
logs till JS 1.7 but not after that.

It would be great help to find change logs.

Regards
Puneet

-----Original Message-----
From:
dev-tech-js-engine-bounces+engg.puneetsharma=gmai...@lists.mozilla.org
[mailto:dev-tech-js-engine-bounces+engg.puneetsharma=gmai...@lists.mozilla
.org] On Behalf Of Puneet Sharma
Sent: Thursday, December 31, 2009 1:43 PM
To: 'David Mandelin'
Cc: dev-tech-...@lists.mozilla.org
Subject: RE: JS Out of memory

Hi,

I would like to correct your testcase for required checks and have
corrected my mistake as well.


#define XP_UNIX

#include <stdio.h>
#include <string.h>
#include <jsapi.h>

Void TestJSEngineEcmaErrorReporter
(
JSContext * hdlCtx,
Const char * pszMessage,
JSErrorReport *pstReport
)
{
Printf("\r\n Error reported : %s",pszMessage);
}


int main()
{
// puneet : it was typo const char *src = "function isnull{}()";
//correct one is : isnull(){} instead of isnull{}()

const char *src = "function isnull(){}";
int length = strlen(src);

JSRuntime *rt = JS_NewRuntime(16 << 10);
JSContext *cx = JS_NewContext(rt, 4 << 10);
JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL);
jsval rv;

JSBool rc;
int i;

/*log all JS errors*/
(void)JS_SetErrorReporter(cx, TestJSEngineEcmaErrorReporter);

/* usually problem occurs*/


for (i = 0; i < 2000; i++) {

rc = JS_EvaluateScript(cx, obj, src, length, "a", 1, &rv);
if (rc == JS_FALSE)
{
printf("\r\n Error while processing EvaluateScript ");
break;
}
}

JS_DestroyContext(cx);
JS_DestroyRuntime(rt);

return 0;
}


Regards
Puneet


-----Original Message-----
From:
dev-tech-js-engine-bounces+engg.puneetsharma=gmai...@lists.mozilla.org
[mailto:dev-tech-js-engine-bounces+engg.puneetsharma=gmai...@lists.mozilla
.org] On Behalf Of David Mandelin

Sent: Thursday, December 31, 2009 1:33 AM
To: Puneet Sharma

0 new messages