Bad memory leak in C# ActiveX control in Internet Explorer

A

Adam Clauss

We have created an ActiveX control (a series of them actually) which can be
loaded into Internet Explorer and accessed via Javascript using the
techniques described here:
http://support.microsoft.com/kb/555687/en-us

Functionally, everything is working as we expect. We can access the C# data
we need from Javascript, including firing C# events which invoke Javascript
code.

However, we started seeing that, should we leave the application open for a
substantial amount of time (for example: overnight), that in the morning IE
will have crashed (with the Windows Error Reporting Dialog popping up).
Also - memory usage of iexplore.exe (per task manager) will be on the order
of gigabytes. Now, I understand that with regards to managed code task
manager is a bad measure of memory usage, but this seems a bit extreme.
During normal usage (when not having been open for some number of hours),
our application shows (again in task manager) between 100-200mb of memory
usage.

There is an additional wrinkle in this in that the Javascript is also making
use of the Adobe SVG viewer to display data.

I know this is a very "vague" description of the problem, but I'm honestly
not sure where to start. I tried attaching debuggers overnight, but it
crashed even through that, no additional useful information in the debugger
(had one attached in managed mode, unmanaged mode, and script mode).

Any thoughts on what kind of memory concerns I should given this
interaction? How does garbage collection hold when objects are exposed via
COM and accessed via Javascript?
 
D

DeveloperX

We have created an ActiveX control (a series of them actually) which can be
loaded into Internet Explorer and accessed via Javascript using the
techniques described here:http://support.microsoft.com/kb/555687/en-us

Functionally, everything is working as we expect. We can access the C# data
we need from Javascript, including firing C# events which invoke Javascript
code.

However, we started seeing that, should we leave the application open for a
substantial amount of time (for example: overnight), that in the morning IE
will have crashed (with the Windows Error Reporting Dialog popping up).
Also - memory usage of iexplore.exe (per task manager) will be on the order
of gigabytes. Now, I understand that with regards to managed code task
manager is a bad measure of memory usage, but this seems a bit extreme.
During normal usage (when not having been open for some number of hours),
our application shows (again in task manager) between 100-200mb of memory
usage.

There is an additional wrinkle in this in that the Javascript is also making
use of the Adobe SVG viewer to display data.

I know this is a very "vague" description of the problem, but I'm honestly
not sure where to start. I tried attaching debuggers overnight, but it
crashed even through that, no additional useful information in the debugger
(had one attached in managed mode, unmanaged mode, and script mode).

Any thoughts on what kind of memory concerns I should given this
interaction? How does garbage collection hold when objects are exposed via
COM and accessed via Javascript?

Have a look here: http://msdn2.microsoft.com/en-us/library/ms979205.aspx

and here's another good guide.

http://www.developerland.com/DotNet/General/125.aspx

Also look into sysinternals process explorer which gives a good over
view of where memory is used, even if you're just looking at COM user
objects and GDI objects.

Hope that helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top