Memory Leak in JScript Engine? 
Author Message
 Memory Leak in JScript Engine?

We are having a problem with memory leaks due to scripts executed in the
JScript script engine.

In our application, we create multiple instances of the JScript script
engine and keep them around for a long time.  These instances are created
on the main thread. Subsequent requests to execute scripts are spun up on
clones of these engines running on separate threads. When the execution
completes, we shut down the clone and also the thread.

We are finding that some heap memory allocated by the script engine is
not being released at all on Windows 98 and only after long periods of
time (~45 minutes) on WindowsNT.  dditionally, the quantity of memory
that is not being released varies in an unpredictable (at least by us)
manner.

We add a named item to the engine that provides methods that return
BSTRs.  It is these BSTRs that seem to be leaking.  We assume the BSTRs
should be free'd when the scripting engine is closed.
We have tried to force garbage collection by using the (deprecated)
CollectGarbage() routing mentioned by  Eric Lippert in a very old post to
comp.lang.javascript, but this does not seem to have any effect.

We are wondering how we can force a garbage collection, or alternately,
why garbage collecting is either failing to run or failing to release all
of the memory.

(1) Is there some way to force a GC in JScript (not VBScript please).
(2) Is the host responsible for freeing the BSTRs passed into the script
engine?

Eric Jenkins



Sat, 15 Dec 2001 03:00:00 GMT  
 Memory Leak in JScript Engine?
How is the named item returning the BSTRs? Is it through a simple [out,
retval] BSTR* retval parameter?

Just checking,
             Drew


Quote:

> We are having a problem with memory leaks due to scripts executed in the
> JScript script engine.

> In our application, we create multiple instances of the JScript script
> engine and keep them around for a long time.  These instances are created
> on the main thread. Subsequent requests to execute scripts are spun up on
> clones of these engines running on separate threads. When the execution
> completes, we shut down the clone and also the thread.

> We are finding that some heap memory allocated by the script engine is
> not being released at all on Windows 98 and only after long periods of
> time (~45 minutes) on WindowsNT.  dditionally, the quantity of memory
> that is not being released varies in an unpredictable (at least by us)
> manner.

> We add a named item to the engine that provides methods that return
> BSTRs.  It is these BSTRs that seem to be leaking.  We assume the BSTRs
> should be free'd when the scripting engine is closed.
> We have tried to force garbage collection by using the (deprecated)
> CollectGarbage() routing mentioned by  Eric Lippert in a very old post to
> comp.lang.javascript, but this does not seem to have any effect.

> We are wondering how we can force a garbage collection, or alternately,
> why garbage collecting is either failing to run or failing to release all
> of the memory.

> (1) Is there some way to force a GC in JScript (not VBScript please).
> (2) Is the host responsible for freeing the BSTRs passed into the script
> engine?

> Eric Jenkins




Sun, 16 Dec 2001 03:00:00 GMT  
 Memory Leak in JScript Engine?
In JScript, use CollectGarbage(); to force a GC.

Follow standard COM rules for freeing the BSTRs.

John Crim
WebGecko Software


Quote:

> (1) Is there some way to force a GC in JScript (not VBScript please).
> (2) Is the host responsible for freeing the BSTRs passed into the script
> engine?

> Eric Jenkins




Thu, 03 Jan 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. JScript memory leak

2. BUG: Memory Leak in JScript toString and toLocaleString Methods

3. Bug Report: JScript Memory Leak

4. JScript Memory Leak

5. JScript Memory Leak

6. mem leak in vbscript engine 5.5 ?

7. pscal memory leaks

8. bizarre memory leak in IISx

9. array memory leak HELP!

10. Behavior memory leak, part 2

11. VBScript Function causes memory leak!

12. Huge Memory Leak if you use JavaScript in IE4

 

 
Powered by phpBB® Forum Software