That's funny, one hour ago I read this exact same document.
I tried to apply this code in several different ways, setting everything to
null, and calling CollectGarbage(), you see it changes the ram usage
slightly, but not much difference.
I also noticed that changing to another URL doesn't seem to free any memory
(MS say it should)
I found some JAVA code using forced garbage collecting, but I presume it
will only free memory used by the Java code.
All on IE5.5 testing create 1000 layers.

Richard.

----- Original Message -----
From: "Raymond Smith" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, March 10, 2001 1:39 AM
Subject: [Dynapi-Dev] Garbage Collection


> Doing some research in the hope of finding clues to help on GC, will be
> posting what I find as I go.  This one refers to a bug in MS JScript
> 3.0,4.0,5.0 as related to an OLE object.  It applies though.
>
> Laters,
>
> Ray
>
> BUG: Excel Does Not Shut Down After Calling the Quit Method When
Automating
> from JScript
>
> --------------------------------------------------------------------------
--
> ----
> The information in this article applies to:
>
> Microsoft Excel versions 2000, 2000 Service Release 1 (SR-1)
> Microsoft Excel 97 for Windows
> Microsoft JScript, versions 3.0, 4.0, 5.0
>
> --------------------------------------------------------------------------
--
> ----
>
>
> SYMPTOMS
> When automating Microsoft Excel from Microsoft JScript, Excel stays in
> memory after calling the Quit method until you close Internet Explorer or
> navigate to another page.
>
>
>
> CAUSE
> JScript is holding on to a reference to Excel. Because there is a
reference
> on Excel when you issue the Quit command, Excel does not shut down.
JScript
> is a garbage collecting language, which means the engine cleans up after
> itself at a certain point, and not when you set the variables to NULL.
When
> you shut down Internet Explorer or move to another page, the engine is
> destroyed. This behavior forces garbage collection and frees the reference
> to Excel.
>
>
>
> RESOLUTION
> To work around this problem, you can call the CollectGarbage method. This
> forces JScript's garbage collection to occur immediately, which releases
the
> reference to Excel. The following code snippet illustrates how to use the
> CollectGarbage method:
>
> <HTML>
> <BODY>
> <INPUT type="button" value="Automate Excel" name=AutomateExcel
> onclick="StartExcel()">
> <SCRIPT LANGUAGE=Javascript>
>   var idTmr = "";
>
>   function StartExcel() {
>     var oExcel;
>
>     oExcel = new ActiveXObject("Excel.Application");
>     oExcel.Quit();
>     oExcel = null;
>     idTmr = window.setInterval("Cleanup();",1);
>   }
>
>   function Cleanup() {
>     window.clearInterval(idTmr);
>     CollectGarbage();
>   }
> </SCRIPT>
> </BODY>
> </HTML>
> Notice that the CollectGarbage method is not called directly after Excel's
> Quit method. You need to give JScript a small amount of time before
calling
> CollectGarbage. A timer is used in this example to show how to wait
briefly
> before forcing garbage collection.
>
> Another workaround to this problem is to use VBScript for Automation of
> Microsoft Excel. Unlike JScript, VBScript is not a garbage collecting
> language and, therefore, references are released when you set the
variables
> to Nothing. Using VBScript, Excel shuts down immediately after calling the
> Quit method and releasing the variables. Please see the "References"
section
> of this article for more information.
>
>
>
> STATUS
> Microsoft has confirmed this to be a bug in the Microsoft products listed
at
> the beginning of this article.
>
>
>
>
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-dev
>


_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-dev

Reply via email to