Using Active Scripting from within C# without leaking memory

Working for about 3 days to get rid of memory leaks when using Microsoft’s Active Scripting from within a C# .NET 2.0 Windows Forms application, I finally managed to create a working example project that runs without memory leaks.

Download example project (VS 2008) with source and binary files

I used Red Gate’s ANTS Memory Profiler to verify for memory leaks, the best tool around for doing such a task.

The key in resolving (see download project) was to call IActiveScript::Close to free any resources.

I hope, this article will help someone in the future when facing a similar issue.

(References: My initial question on Stack Overflow)

Ein Gedanke zu „Using Active Scripting from within C# without leaking memory

  1. Ludvig sagt:

    Hello,

    I have tried the enclosed code/Project, but it seems to use more and more memory for each click on „Run Script“. Is that not a memory leak?

    regards
    Ludvig

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.