Behavior memory leak, part 2 
Author Message
 Behavior memory leak, part 2

    Does this replicate when behaviors are attached via STYLE tags or CSS.
It is obviously a problem
with the addBehavior and removeBehavior code.  It is possible that IE is
storing state information for
the HTC even thought is is a blank HTC.  100 dynamically created behaviors
can pose quite a memory
problem to a system though and at first thought this should definitely be
remedied.

    - Justin Rogers, CEO DigiTec Web Consultants



Sat, 08 Jun 2002 03:00:00 GMT  
 Behavior memory leak, part 2
I believe it does. Please see my original

--VS.


Quote:
>     Does this replicate when behaviors are attached via STYLE tags or CSS.



Sun, 09 Jun 2002 03:00:00 GMT  
 Behavior memory leak, part 2

Valentin

I have tried both your examples and can confirm your observations, I see the same thing...

WIN98+SP1
IE5 5.00.2314.1003 (Upd.versions?? q231452;q231450;3717;q240308)
MSHTML 5.00.2314.1000
PWS 4.02.0662

So it's not only NT/2000 ...

HTH
Raj

Quote:

> Greetings,

> Could anyone please confirm this and fix before 5.5 release? For me it
> repros on any version of IE 5.5 on NT4 and on IE5 in 2000RC3.

> Each time a behavior is attached and then removed, there is a memory leak
> which is twice the size of the HTC file (the attached ZIP is a working
> sample). The same thing happens I believe when the element is removed from
> the document hierarchy (see the original post below):

> Here are the steps to repro, in case you can't get the attached file.

> (1) Create an empty behavior (htcleak.htc) and add more comments to make the
> file, say, 250 KB in size:

>     <PUBLIC:COMPONENT>
>     <SCRIPT>
>     // -- add more comment lines here to increase the size of the file --
>     </SCRIPT>
>     </PUBLIC:COMPONENT>

> (2) Create an HTML page and change extension to HTA (it will help to track
> the process memory):

>     <html><head><script>
>         var id;
>         function doAction() {
>             if (theButton.innerText=="Remove") {
>                 theDiv.removeBehavior(id);
>                 theButton.innerText="Add";
>             }else{
>                 id=theDiv.addBehavior("htcleak.htc");
>                 theButton.innerText="Remove";
>             }
>             CollectGarbage();    // this should release all unused memory
>         }
>     </script></head><body>
>     <div id=theDiv>
>         This is the place to which empty behavior is attached
>     </div>
>     <button id="theButton"
>         onclick="doAction()"
>         ondblclick="doAction()"  style="width:200px"
>     >Do it!</button>
>     </body></html>

> (3) Open NT Task manager, notice the process' "Mem Usage" and "VM Size" for
> MSHTA.EXE. Push the button twice. See new process size. Repeat. See the
> process memory growth and calculate the delta for each cycle. Compare to the
> size of the HTC file.

> regards,
> --VS.





> > > Hello,

> > > I am trying to put an element with a behavior on a "popup" DIV. However,
> > > when that div element is destroyed, some memory (20-100 Kilobytes) is
> not
> > > released. Can anybody else reproduce it? What can be done about it?

> > Hi,

> > Yes, this repros on my copy of Windows 2000 Server.

> > My guess is that you are trying to delete the div, but JScript still has a
> > reference to it (after all, you're calling its onclick handler!) so it
> can't
> > be destroyed.

> > Try hiding the div (setting style="display: none") and using a
> setTimeout()
> > call to destroy the div after the event handler has returned.

> > Peter

> > --
> > Peter J. Torr - Microsoft Windows Script Program Manager

> > Please do not e-mail me with questions - post them to this
> > newsgroup instead. Thankyou!



Sun, 09 Jun 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. pscal memory leaks

2. bizarre memory leak in IISx

3. array memory leak HELP!

4. JScript memory leak

5. Memory Leak in JScript Engine?

6. VBScript Function causes memory leak!

7. Huge Memory Leak if you use JavaScript in IE4

8. memory leak?

9. No error reported and memory leak if error occurs in Class_Terminate

10. Possible memory leak - error '800a0007'

11. Database not available causing memory leak in vbscript

12. Memory leak in HP LaserJet 4Si MX?

 

 
Powered by phpBB® Forum Software