6

Has anybody ever faced a memory leak problem with IActiveScriptParse32::ParseScriptText when using it in C#? I need a ScriptEngine that is able to parse JavaScript-Code. (Everything works fine, except the used memory)

The problem is, that the longer my passed JavaScript-Code is, the more unmanaged memory is allocated by the function "ParseScriptText".

I have no idea how to free the allocated space. I actually already run Marshal.ReleaseComObject(parse32) after parsing my script but somehow the used memory does not go down anymore.

xileb0
  • 451
  • 2
  • 6
  • 18
  • 2
    There are very good chances that the problem, if any (you're using managed code so are you sure there's a true memory leak) lies in your code. Can you provide a reproducing project so we can take a look at it? Also, since you're using C#, the way you do interop also matters a lot. – Simon Mourier Jun 29 '19 at 14:07
  • 1
    You can use [ClearScript](https://github.com/microsoft/ClearScript/) or examine how they have done by looking at the [source code](https://github.com/microsoft/ClearScript/search?q=ParseScriptText%28&unscoped_q=ParseScriptText%28). `Windows` namespace in the project is the place. – Kul-Tigin Jul 02 '19 at 14:29
  • 1
    Hi guys, first of all thank you for your answers. I actually found an alternative solution. I tried JINT. (https://github.com/sebastienros/jint) It works perfectly and does not have a memory leak or something. The only problem: It is casesensitive... This is a big problem for my project. Is there any way to ignore uppercase/lowercase in my scripts? – xileb0 Jul 03 '19 at 13:31
  • You should delete your question now – Simon Mourier Jul 04 '19 at 06:02
  • "Questions with open bounties cannot be deleted" ;) – xileb0 Jul 04 '19 at 06:19

0 Answers0