Skip to content

Possible memory leak? #14

Description

@sp00x

It was not entirely clear to me that the process of doing .Source = '..'; and .Run() several times was just appending to the source code, like a REPL, but anyways it's cool that it works like this. However, re-defining variables or functions seem to lead to memory leaks, and I'm not sure if this is intended or part of the ECMA script or not, i.e. the following will log "A2" twice, both in Node.js and RO Script:

functionA(){console.log("A1")};A();functionA(){console.log("A2")};A();

So, a short example:

EcmaScriptComponentscript=newRemObjects.Script.EcmaScriptComponent();// imagine there is a console.log()script.Source=@"function A() { console.log(""A1"") }; A(); function A() { console.log(""A2"") }; A();";script.Run();// logs A2 twicescript.Source=@"function B() { console.log(""B1"") }; B();";script.Run();// logs B1script.Source=@"function B() { console.log(""B2"") }; B();";script.Run();// logs B2script.Source=@"function B() { console.log(""B3"") }; B();";script.Run();// logs B3script.Source="var foo = 'bar';";script.Run();script.Source="var foo = ''; console.log('foo is: ' + foo)";// logs bar as expected, unless we call script.Clear() in which case "var is unexpected"-borks.script.Run();while(true){//script.Source = "var foo = 'bar';"; // leaks a bitscript.Source="function A() {}";// leaks a lotscript.Run();}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions