COM object releasing in ASP+JScript 
Author Message
 COM object releasing in ASP+JScript

Hi, Giys!
Does anyone encountered with problem, that ASP does not releases my COM
objects if I'm using JScript.
In case of VBS all is OK. Using VBS stub with setting object reference to
Nothing has no effect :(
When session time outs, the memory still stays allocated (according to
Available memory performance counter).

WBR, Dave. CUL8R!



Mon, 05 Apr 2004 20:29:21 GMT  
 COM object releasing in ASP+JScript
Hi

You can try CollectGarbage(); although I don't reccomend it

Garbage collection works something like this

When the script engine is shut down, garbage is collected.

When 256 variants, or more than 64KB of strings, or more than 4096 array slots have been allocated, the garbage collector sets a flag that says collect soon.

Whenever a new statement is executed or the script de{*filter*} starts, that flag is checked, and if it is set, a collection is done

--

--
Best Regards
  Vidar Petursson
 ==================================
Microsoft Internet Client and Controls MVP
 ==================================
  http://www.*-*-*.com/
  http://www.*-*-*.com/



 ==================================
  No matter where you go there you are
 ==================================


Quote:
> Hi, Giys!
> Does anyone encountered with problem, that ASP does not releases my COM
> objects if I'm using JScript.
> In case of VBS all is OK. Using VBS stub with setting object reference to
> Nothing has no effect :(
> When session time outs, the memory still stays allocated (according to
> Available memory performance counter).

> WBR, Dave. CUL8R!



Mon, 05 Apr 2004 21:27:51 GMT  
 COM object releasing in ASP+JScript



Quote:
> Hi, Giys!
> Does anyone encountered with problem, that ASP does not releases my COM
> objects if I'm using JScript.
> In case of VBS all is OK. Using VBS stub with setting object reference to
> Nothing has no effect :(
> When session time outs, the memory still stays allocated (according to
> Available memory performance counter).

> WBR, Dave. CUL8R!

In the Session_OnEnd() function (or whatever it is,  I can't remember) make
sure that you null out any objects you have created. Better yet, null them
when you are done with them. This way, if all references to the object have
been nulled, the GC will clean them up when it next runs. Most likely,
somewhere you are keeping a reference to the object, so the GC isn't
cleaning it up when it runs.

Matt



Tue, 06 Apr 2004 01:14:51 GMT  
 COM object releasing in ASP+JScript



Quote:
> Hi, Giys!
> Does anyone encountered with problem, that ASP does not releases my COM
> objects if I'm using JScript.
> In case of VBS all is OK. Using VBS stub with setting object reference to
> Nothing has no effect :(
> When session time outs, the memory still stays allocated (according to
> Available memory performance counter).

> WBR, Dave. CUL8R!

In the Session_OnEnd() function (or whatever it is,  I can't remember) make
sure that you null out any objects you have created. Better yet, null them
when you are done with them. This way, if all references to the object have
been nulled, the GC will clean them up when it next runs. Most likely,
somewhere you are keeping a reference to the object, so the GC isn't
cleaning it up when it runs.

Matt



Tue, 06 Apr 2004 01:15:29 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. JScript doesn't Release COM objects?

2. COM-Object in ASP with COM-Object as parameter

3. COM-Object in ASP with COM-Object as Parameter

4. Releasing references to COM Automation objects

5. Need to Access ASP Session Objects from External COM Object

6. JScript or Javascript object detecting browser release number

7. jscript & releasing activex objects

8. How to explicitly release an object in JScript

9. Callbacks from COM objects in Jscript

10. Catching COM object errors in server-side jscript?

11. Using COM objects that return recordsets from JScript

12. JSCript and returning parameters from COM object

 

 
Powered by phpBB® Forum Software